[Bug target/88005] [7/8/9 Regression] GCC on hppa misoptimisation function pointer call

2018-11-13 Thread skrll at netbsd dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88005

--- Comment #2 from Nick Hudson  ---

yes, it does.

Nick

nick@zoom:~/gcc$ ./inst/bin/hppa--linux-gcc -O2 -fno-delete-null-pointer-checks
-S -o pdc.s pdc.i
nick@zoom:~/gcc$ cat pdc.s
.LEVEL 1.1
.text
.align 4
.globl pdc_init
.type   pdc_init, @function
pdc_init:
.PROC
.CALLINFO FRAME=64,CALLS,SAVE_RP
.ENTRY
stw %r2,-20(%r30)
addil LR'pdc-$global$,%r27
ldo 64(%r30),%r30
ldw 0(%r0),%r22
ldo RR'pdc-$global$(%r1),%r1
stw %r0,-52(%r30)
ldi 0,%r23
stw %r22,0(%r1)
addil LR'pdcbuf-$global$,%r27
ldi 2,%r25
ldo RR'pdcbuf-$global$(%r1),%r24
ldi 10,%r26
bb,>=,n %r22,30,.+12
ldw 2(%r22),%r19
ldw -2(%r22),%r22
ble 0(%sr4,%r22)
copy %r31,%r2
ldw -84(%r30),%r2
bv %r0(%r2)
ldo -64(%r30),%r30
.EXIT
.PROCEND
.size   pdc_init, .-pdc_init
.comm   pdcbuf,256,64
.comm   pdc,4,4
.ident  "GCC: (GNU) 9.0.0 20181112 (experimental)"
nick@zoom:~/gcc$

(In reply to Alexander Monakov from comment #1)
> Isn't simply because the code dereferences a null pointer when assigning to
> 'pdc'? Does it "work" as expected with -fno-delete-null-pointer-checks?

[Bug target/88005] New: [6/7/8/9] Regression GCC on hppa misoptimisation function pointer call

2018-11-13 Thread skrll at netbsd dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88005

Bug ID: 88005
   Summary: [6/7/8/9] Regression GCC on hppa misoptimisation
function pointer call
   Product: gcc
   Version: 9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: skrll at netbsd dot org
  Target Milestone: ---

Here's a testcase 


typedef int (*pdcio_t)(int, int, ...);

pdcio_t pdc;
int pdcbuf[64] __attribute__ ((__aligned__(64)));

struct pagezero {

 int (*mem_pdc)(void);
};

void
pdc_init(void)
{
 int err;

 pdc = (pdcio_t)((struct pagezero *)0)->mem_pdc;

 err = (*pdc)(10, 2, pdcbuf, 0, 0);
}



Here's the generated code


.LEVEL 1.1
.text
.align 4
.globl pdc_init
.type   pdc_init, @function
pdc_init:
.PROC
.CALLINFO FRAME=0,NO_CALLS
.ENTRY
ldw 0(%r0),%r28
addit,<> 1,%r0,%r0
.EXIT
.PROCEND
.size   pdc_init, .-pdc_init
.comm   pdcbuf,256,64
.comm   pdc,4,4
.ident  "GCC: (GNU) 9.0.0 20181112 (experimental)"
---

[Bug target/60039] sh3 optimisation bug with -O2

2014-03-18 Thread skrll at netbsd dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60039

--- Comment #8 from Nick Hudson skrll at netbsd dot org ---
On 03/18/14 02:34, kkojima at gcc dot gnu.org wrote:
 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60039

 --- Comment #7 from Kazumoto Kojima kkojima at gcc dot gnu.org ---
 Ugh, then this is an old problem and we've missed to give a correct
 clobber information to udivsi3_i1 insn for PIC.  Does the patch
 below fix the issue?

 --- gcc/config/sh/sh.md.orig2013-09-13 17:38:22.0 +0900
 +++ gcc/config/sh/sh.md2014-03-18 11:08:19.868887133 +0900
 @@ -2152,6 +2152,7 @@
   (udiv:SI (reg:SI R4_REG) (reg:SI R5_REG)))
  (clobber (reg:SI T_REG))
  (clobber (reg:SI PR_REG))
 +   (clobber (reg:SI R1_REG))
  (clobber (reg:SI R4_REG))
  (use (match_operand:SI 1 arith_reg_operand r))]
 TARGET_SH1  TARGET_DIVIDE_CALL_DIV1

yes, this patch helps ld.elf_so.

I seem to have a different problem in libc now.

Thanks,
Nick


[Bug target/60039] sh3 optimisation bug with -O2

2014-02-07 Thread skrll at netbsd dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60039

--- Comment #4 from Nick Hudson skrll at netbsd dot org ---
Created attachment 32076
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=32076action=edit
Full assembler output


[Bug target/60039] New: sh3 optimisation bug with -O2

2014-02-03 Thread skrll at netbsd dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60039

Bug ID: 60039
   Summary: sh3 optimisation bug with -O2
   Product: gcc
   Version: 4.8.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: skrll at netbsd dot org

Created attachment 32020
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=32020action=edit
NetBSD's /usr/src/libexec/ld.elf_so/xmalloc

Compiling the attached file for NetBSD/sh3 results in incorrect code.


[Bug target/60039] sh3 optimisation bug with -O2

2014-02-03 Thread skrll at netbsd dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60039

--- Comment #1 from Nick Hudson skrll at netbsd dot org ---
With -O2 I see invalid pointer derefs in the morecore function called by
imalloc


[Bug target/60039] sh3 optimisation bug with -O2

2014-02-03 Thread skrll at netbsd dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60039

--- Comment #2 from Nick Hudson skrll at netbsd dot org ---
/wrk/obj/landisk/wrk/netbsd/gcc48x/src/tooldir.NetBSD-6.99.28-amd64/bin/shle--netbsdelf-gcc
-fvisibility=hidden -fstack-protector -Wstack-protector
-Wno-error=stack-protector   --param ssp-buffer-size=1  -g -std=gnu99  -Wall
-Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-sign-compare 
-Wno-traditional  -Wa,--fatal-warnings -Wreturn-type -Wswitch -Wshadow
-Wcast-qual -Wwrite-strings -Wextra -Wno-unused-parameter -Wno-sign-compare
-Wsign-compare -Wformat=2  -Wno-format-zero-length  -Wno-uninitialized
-Wno-maybe-uninitialized -Werror   
--sysroot=/wrk/obj/landisk/wrk/netbsd/gcc48x/src/destdir.landisk -fpic
-DELFSIZE=32 -DLIBDIR=\/usr/lib\ -D_PATH_RTLD=\/libexec/ld.elf_so\
-I/wrk/netbsd/gcc48x/src/libexec/ld.elf_so -I. -DRTLD_LOADER -D_RTLD_SOURCE
-DCOMBRELOC  -D_FORTIFY_SOURCE=2 -c -g  -O2   /tmp/xmalloc.i -o
/tmp/xmalloc.O2.o

Compile line


[Bug target/60039] sh3 optimisation bug with -O2

2014-02-03 Thread skrll at netbsd dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60039

--- Comment #3 from Nick Hudson skrll at netbsd dot org ---
 1b6:   93 60   mov r9,r0
 1b8:   76 02   mov.l   r7,@(r0,r2)
while (--nblks  0) {
 1ba:   10 41   dt  r1
 1bc:   03 8f   bf.s1c6 imalloc+0xd6
 1be:   73 62   mov r7,r2
 * If nothing in hash bucket right now,
 * request more memory from the system.
 */
if ((op = nextf[bucket]) == NULL) {
morecore(bucket);
if ((op = nextf[bucket]) == NULL)
 1c0:   08 a0   bra 1d4 imalloc+0xe4
 1c2:   28 22   tst r2,r2
 * free list for this hash bucket.
 */
nextf[bucket] = op;
while (--nblks  0) {
op-ov_next = (union overhead *)((caddr_t)op + sz);
op = (union overhead *)((caddr_t)op + sz);
 1c4:   33 62   mov r3,r2
 * Add new memory allocated to that on
 * free list for this hash bucket.
 */
nextf[bucket] = op;
while (--nblks  0) {
op-ov_next = (union overhead *)((caddr_t)op + sz);
 1c6:   23 63   mov r2,r3
 1c8:   dc 33   add r13,r3
/*
 * Add new memory allocated to that on
 * free list for this hash bucket.
 */
nextf[bucket] = op;
while (--nblks  0) {
 1ca:   10 41   dt  r1
 1cc:   fa 8f   bf.s1c4 imalloc+0xd4
 1ce:   32 22   mov.l   r3,@r2
 1d0:   73 62   mov r7,r2

r2 at 0x1ce is somehow wrong


[Bug target/30039] New: HPPA: Incorrect code generated on 64bit host

2006-12-01 Thread skrll at netbsd dot org
Use of long long constants produces incorrect code when cross compiling for the
hppa target on a 64 bit host


$ hppa--linux-gcc -v
Using built-in specs.
Target: hppa--linux
Configured with: /home/nick/gnu/gcc/configure --target=hppa--linux
--prefix=/home/nick/gnu/path --enable-languages=c : (reconfigured)
/home/nick/gnu/gcc/configure --target=hppa--linux --prefix=/home/nick/gnu/path
--enable-languages=c
Thread model: posix
gcc version 4.1.2 20061021 (prerelease) (NetBSD nb1 20061021)
$ hppa--linux-gcc -mpa-risc-1-1 -msoft-float -mdisable-fpregs -S test3.i -o
test3.s
$ cat test3.s
.LEVEL 1.1
.text
.align 4
.globl foo
.type   foo, @function
foo:
.PROC
.CALLINFO FRAME=64,NO_CALLS,SAVE_SP,ENTRY_GR=3
.ENTRY
copy %r3,%r1
copy %r30,%r3
stwm %r1,64(%r30)
ldil L'1221929280,%r29
ldi 0,%r28
ldo R'1221929280(%r29),%r29
stw %r28,8(%r3)
stw %r29,12(%r3)
ldw 8(%r3),%r19
ldw 12(%r3),%r20
extru %r19,31,28,%r28
extru %r20,31,32,%r29
ldo 64(%r3),%r30
ldwm -64(%r30),%r3
bv,n %r0(%r2)
.EXIT
.PROCEND
.size   foo, .-foo
.ident  GCC: (GNU) 4.1.2 20061021 (prerelease) (NetBSD nb1 20061021)
$


-- 
   Summary: HPPA: Incorrect code generated on 64bit host
   Product: gcc
   Version: 4.1.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: skrll at netbsd dot org
 GCC build triplet: sparc64--netbsd
  GCC host triplet: sparc64--netbsd
GCC target triplet: hppa--linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30039



[Bug target/30039] HPPA: Incorrect code generated on 64bit host

2006-12-01 Thread skrll at netbsd dot org


--- Comment #1 from skrll at netbsd dot org  2006-12-01 13:40 ---
Created an attachment (id=12723)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12723action=view)
reduced test case from netbsd src/sys/kern/kern_uuid.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30039