[Bug middle-end/88246] Abort signal terminated program collect2 - munmap_chunk(): invalid pointer

2018-12-03 Thread krebbel at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88246

Andreas Krebbel  changed:

   What|Removed |Added

 Status|RESOLVED|CLOSED

--- Comment #11 from Andreas Krebbel  ---
Bootstrap works again.

[Bug middle-end/88246] Abort signal terminated program collect2 - munmap_chunk(): invalid pointer

2018-11-29 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88246

--- Comment #9 from Martin Liška  ---
Author: marxin
Date: Thu Nov 29 17:17:39 2018
New Revision: 266631

URL: https://gcc.gnu.org/viewcvs?rev=266631=gcc=rev
Log:
Fix thinko in transition to memop_ret type (PR middle-end/88246).

2018-11-29  Martin Liska  

PR middle-end/88246
* builtins.c (expand_movstr): Fix thinko introduced
when switching to the new enum.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/builtins.c

[Bug middle-end/88246] Abort signal terminated program collect2 - munmap_chunk(): invalid pointer

2018-11-29 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88246

Martin Liška  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #10 from Martin Liška  ---
Fixed.

[Bug middle-end/88246] Abort signal terminated program collect2 - munmap_chunk(): invalid pointer

2018-11-29 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88246

--- Comment #8 from Martin Liška  ---
I found it, will send patch soon.

[Bug middle-end/88246] Abort signal terminated program collect2 - munmap_chunk(): invalid pointer

2018-11-29 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88246

Jeffrey A. Law  changed:

   What|Removed |Added

 CC||law at redhat dot com

--- Comment #7 from Jeffrey A. Law  ---
Removing -gtoggle from the compilation of find-file.c got me a bit more info:

==57496== 
==57496== Invalid write of size 1
==57496==at 0x1010E18: find_a_file(path_prefix*, char const*, int)
(file-find.c:81)
==57496==by 0x1005E31: main (in
/home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
==57496==  Address 0x4ad08ef is 0 bytes after a block of size 31 alloc'd
==57496==at 0x4831090: malloc (vg_replace_malloc.c:299)
==57496==by 0x10806DF: xmalloc (in
/home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
==57496==by 0x1010DEF: find_a_file(path_prefix*, char const*, int)
(file-find.c:47)
==57496==by 0x1005E31: main (in
/home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
==57496== 
==57496== Invalid write of size 1
==57496==at 0x1010E30: find_a_file(path_prefix*, char const*, int)
(file-find.c:82)
==57496==by 0x1005E31: main (in
/home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
==57496==  Address 0x4ad08fb is 12 bytes after a block of size 31 alloc'd
==57496==at 0x4831090: malloc (vg_replace_malloc.c:299)
==57496==by 0x10806DF: xmalloc (in
/home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
==57496==by 0x1010DEF: find_a_file(path_prefix*, char const*, int)
(file-find.c:47)
==57496==by 0x1005E31: main (in
/home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
==57496== 
==57496== Syscall param stat(file_name) points to unaddressable byte(s)
==57496==at 0x49FBD90: _xstat (in /usr/lib64/libc-2.26.so)
==57496==by 0x1010E3D: stat (stat.h:451)
==57496==by 0x1010E3D: find_a_file(path_prefix*, char const*, int)
(file-find.c:84)
==57496==by 0x1005E31: main (in
/home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
==57496==  Address 0x4ad08fb is 12 bytes after a block of size 31 alloc'd
==57496==at 0x4831090: malloc (vg_replace_malloc.c:299)
==57496==by 0x10806DF: xmalloc (in
/home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
==57496==by 0x1010DEF: find_a_file(path_prefix*, char const*, int)
(file-find.c:47)
==57496==by 0x1005E31: main (in
/home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
==57496==

[Bug middle-end/88246] Abort signal terminated program collect2 - munmap_chunk(): invalid pointer

2018-11-29 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88246

--- Comment #6 from Martin Liška  ---
Using cross-compiler I see following difference before and after my patch:

_Z11find_a_fileP11path_prefixPKci:
 .LFB265:
stmg%r7,%r15,56(%r15)
 .LCFI0:
l   %r12,8(%r2)
lgr %r8,%r2
lgr %r2,%r3
lhi %r0,0
lghi%r1,0
ahi %r12,1
larl%r7,_ZL5debug
srst%r1,%r2
jo  .-4
sgr %r1,%r3
aghi%r15,-304
 .LCFI1:
ar  %r12,%r1
cli 0(%r7),0
lgr %r10,%r3
lgr %r9,%r4
jne .L31
lgfr%r2,%r12
brasl   %r14,xmalloc
cli 0(%r10),47
lgr %r12,%r2
je  .L32
 .L6:
lg  %r11,0(%r8)
ltgr%r11,%r11
je  .L12
 .L14:
-   lgr %r5,%r12
lg  %r1,0(%r11)
lhi %r0,0
+   lgr %r5,%r10
+   mvst%r12,%r1
+   jo  .-4
+   lgr %r1,%r12
la  %r4,160(%r15)
lgr %r3,%r12
-   mvst%r5,%r1
-   jo  .-4
-   lgr %r1,%r10
lghi%r2,1
-   mvst%r5,%r1
+   mvst%r1,%r5
jo  .-4
brasl   %r14,__xstat
ltr %r2,%r2
jl  .L13
llill   %r1,61440

[Bug middle-end/88246] Abort signal terminated program collect2 - munmap_chunk(): invalid pointer

2018-11-29 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88246

Martin Liška  changed:

   What|Removed |Added

 CC||law at gcc dot gnu.org

--- Comment #5 from Martin Liška  ---
Jeff can also see the problem, there's a valgrind backtrace from him:

==56970==
==56970== Invalid write of size 1
==56970==at 0x1010E18: find_a_file(path_prefix*, char const*, int)
(in /home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
==56970==by 0x1005E31: main (in
/home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
==56970==  Address 0x4ad08ef is 0 bytes after a block of size 31 alloc'd
==56970==at 0x4831090: malloc (vg_replace_malloc.c:299)
==56970==by 0x10806DF: xmalloc (in
/home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
==56970==by 0x1010DEF: find_a_file(path_prefix*, char const*, int)
(in /home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
==56970==by 0x1005E31: main (in
/home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
==56970==
==56970== Invalid write of size 1
==56970==at 0x1010E30: find_a_file(path_prefix*, char const*, int)
(in /home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
==56970==by 0x1005E31: main (in
/home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
==56970==  Address 0x4ad08fb is 12 bytes after a block of size 31 alloc'd
==56970==at 0x4831090: malloc (vg_replace_malloc.c:299)
==56970==by 0x10806DF: xmalloc (in
/home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
==56970==by 0x1010DEF: find_a_file(path_prefix*, char const*, int)
(in /home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
==56970==by 0x1005E31: main (in
/home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
==56970==
==56970== Syscall param stat(file_name) points to unaddressable byte(s)
==56970==at 0x49FBD90: _xstat (in /usr/lib64/libc-2.26.so)
==56970==by 0x1010E3D: find_a_file(path_prefix*, char const*, int)
(in /home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
==56970==by 0x1005E31: main (in
/home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
==56970==  Address 0x4ad08fb is 12 bytes after a block of size 31 alloc'd
==56970==at 0x4831090: malloc (vg_replace_malloc.c:299)
==56970==by 0x10806DF: xmalloc (in
/home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
==56970==by 0x1010DEF: find_a_file(path_prefix*, char const*, int)
(in /home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
==56970==by 0x1005E31: main (in
/home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
==56970==

valgrind: m_mallocfree.c:307 (get_bszB_as_is): Assertion 'bszB_lo ==
bszB_hi' failed.
valgrind: Heap block lo/hi size mismatch: lo = 96, hi = 3417228689894289267.
This is probably caused by your program erroneously writing past the
end of a heap block and corrupting heap metadata.  If you fix any
invalid writes reported by Memcheck, this assertion failure will
probably go away.  Please try that before reporting this as a bug.


host stacktrace:
==56970==at 0x8000521BC: ??? (in
/usr/lib64/valgrind/memcheck-s390x-linux)
==56970==by 0x80005206D: ??? (in
/usr/lib64/valgrind/memcheck-s390x-linux)

sched status:
  running_tid=1

Thread 1: status = VgTs_Runnable (lwpid 56970)
==56970==at 0x4832522: free (vg_replace_malloc.c:530)
==56970==by 0x1010E95: find_a_file(path_prefix*, char const*, int)
(in /home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
==56970==by 0x1005E31: main (in
/home/nfs/law/jenkins/workspace/s390x-linux-gnu/obj/gcc/gcc/collect2)
client stack range: [0x1FFEFFD000 0x1FFF000FFF] client SP: 0x1FFEFFF010
valgrind stack range: [0x1002BA2000 0x1002CA1FFF] top usage: 9784 of 1048576

[Bug middle-end/88246] Abort signal terminated program collect2 - munmap_chunk(): invalid pointer

2018-11-29 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88246

--- Comment #4 from Martin Liška  ---
I see segfault in driver in:

Thread 2.1 "collect2" received signal SIGABRT, Aborted.
[Switching to process 11687]
0x03fffbd4192e in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x03fffbd4192e in raise () from /lib64/libc.so.6
#1  0x03fffbd2391c in abort () from /lib64/libc.so.6
#2  0x03fffbd85d00 in __libc_message () from /lib64/libc.so.6
#3  0x03fffbd8cbe0 in malloc_printerr () from /lib64/libc.so.6
#4  0x03fffbd9131c in free_check () from /lib64/libc.so.6
#5  0x0101005c in find_a_file (pprefix=pprefix@entry=0x10ca7e0 ,
name=, name@entry=0x1089f78 "real-ld", mode=mode@entry=1) at
../../gcc/file-find.c:104
#6  0x0100514a in main (argc=, argv=) at
../../gcc/collect2.c:1141
(gdb) frame 5
#5  0x0101005c in find_a_file (pprefix=pprefix@entry=0x10ca7e0 ,
name=, name@entry=0x1089f78 "real-ld", mode=mode@entry=1) at
../../gcc/file-find.c:104
104   free (temp);
xgcc: fatal error: Killed signal terminated program collect2

It would be handy to run that in valgrind (which I don't have access to).
Can you Andreas please do that?

[Bug middle-end/88246] Abort signal terminated program collect2 - munmap_chunk(): invalid pointer

2018-11-29 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88246

--- Comment #3 from Martin Liška  ---
Created attachment 45121
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45121=edit
Clean up patch

The patch is only cosmetic, should not affect generated code.

[Bug middle-end/88246] Abort signal terminated program collect2 - munmap_chunk(): invalid pointer

2018-11-29 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88246

--- Comment #2 from Martin Liška  ---
I can confirm that in openSUSE build service, but I have very limited access to
a s390x machine. I checked the patch and I don't see any obvious error.
Can you please debug that?

[Bug middle-end/88246] Abort signal terminated program collect2 - munmap_chunk(): invalid pointer

2018-11-28 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88246

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2018-11-28
   Assignee|unassigned at gcc dot gnu.org  |marxin at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Martin Liška  ---
Mine.

[Bug middle-end/88246] Abort signal terminated program collect2 - munmap_chunk(): invalid pointer

2018-11-28 Thread krebbel at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88246

Andreas Krebbel  changed:

   What|Removed |Added

 Target||s390x-redhat-linux
   Priority|P3  |P1
 CC||marxin at gcc dot gnu.org
   Host||s390x-redhat-linux
  Build||s390x-redhat-linux