bugmake - Bugs: bug #50790, Some kind of memory corruption in...

 
 

bug #50790: Some kind of memory corruption in error messages with gcc-6.3.0 -flto=4

Submitter:  Jan Ziak <atomsymbol>
Submitted:  Wed 12 Apr 2017 06:07:20 PM UTC
Votes: 1
 
Severity:  3 - Normal Item Group:  None
Status:  Duplicate Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  4.2.1 Operating System:  POSIX-Based
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 27 May 2017 08:25:58 PM UTC, comment #3: 

This is a duplicate of bug #50909 as Enrique suggests.

Thanks for the details!

Paul D. Smith <psmith>
Group administrator
Tue 02 May 2017 03:54:53 AM UTC, comment #2: 

If the issue is the garbled error message in the output then I think I found a solution for that.

See bug 50909:
https://savannah.gnu.org/bugs/?50909

enrique olaizola <gnuser17>
Tue 18 Apr 2017 09:19:56 AM UTC, comment #1: 

It isn't a gcc bug. Please fix it in make-4.2.1+ source code:

==22022== Memcheck, a memory error detector
==22022== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==22022== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==22022== Command: /usr/bin/_make -f /tmp/ccEUTdnj.mk -j4 all
==22022==
f.o: In function `f':
f.cc:3155: undefined reference to `tul::ff()'
collect2: error: ld returned 1 exit status
==22022== Invalid read of size 1
==22022==    at 0x4A09EF2: strlen (vg_replace_strmem.c:454)
==22022==    by 0x4135B6: child_error (job.c:497)
==22022==    by 0x415577: reap_children (job.c:866)
==22022==    by 0x421C6F: update_goal_chain (remake.c:112)
==22022==    by 0x407E0B: main (main.c:2558)
==22022==  Address 0x4caf710 is 0 bytes inside a block of size 200 free'd
==22022==    at 0x4A0804B: free (vg_replace_malloc.c:534)
==22022==    by 0x41EC52: read_all_makefiles (read.c:210)
==22022==    by 0x4073BE: main (main.c:1969)
==22022==  Block was alloc'd at
==22022==    at 0x4A06E8F: malloc (vg_replace_malloc.c:306)
==22022==    by 0x418334: xmalloc (misc.c:221)
==22022==    by 0x40B5C7: initialize_variable_output (expand.c:84)
==22022==    by 0x40BDA0: variable_expand_string (expand.c:203)
==22022==    by 0x40C2A0: variable_expand (expand.c:417)
==22022==    by 0x40C2A0: variable_expand_for_file (expand.c:464)
==22022==    by 0x40C2D3: allocated_variable_expand_for_file (expand.c:564)
==22022==    by 0x41EC04: read_all_makefiles (read.c:194)
==22022==    by 0x4073BE: main (main.c:1969)
==22022==
==22022== Invalid read of size 1
==22022==    at 0x32B3446A64: vfprintf (vfprintf.c:1631)
==22022==    by 0x32B34F7DD7: __vsprintf_chk (vsprintf_chk.c:85)
==22022==    by 0x32B34F7D25: __sprintf_chk (sprintf_chk.c:31)
==22022==    by 0x4135F0: sprintf (stdio2.h:33)
==22022==    by 0x4135F0: child_error (job.c:498)
==22022==    by 0x415577: reap_children (job.c:866)
==22022==    by 0x421C6F: update_goal_chain (remake.c:112)
==22022==    by 0x407E0B: main (main.c:2558)
==22022==  Address 0x4caf710 is 0 bytes inside a block of size 200 free'd
==22022==    at 0x4A0804B: free (vg_replace_malloc.c:534)
==22022==    by 0x41EC52: read_all_makefiles (read.c:210)
==22022==    by 0x4073BE: main (main.c:1969)
==22022==  Block was alloc'd at
==22022==    at 0x4A06E8F: malloc (vg_replace_malloc.c:306)
==22022==    by 0x418334: xmalloc (misc.c:221)
==22022==    by 0x40B5C7: initialize_variable_output (expand.c:84)
==22022==    by 0x40BDA0: variable_expand_string (expand.c:203)
==22022==    by 0x40C2A0: variable_expand (expand.c:417)
==22022==    by 0x40C2A0: variable_expand_for_file (expand.c:464)
==22022==    by 0x40C2D3: allocated_variable_expand_for_file (expand.c:564)
==22022==    by 0x41EC04: read_all_makefiles (read.c:194)
==22022==    by 0x4073BE: main (main.c:1969)

Jan Ziak <atomsymbol>
Wed 12 Apr 2017 06:07:20 PM UTC, original submission:  

Hello.

The following is the output of a Makefile-based project which uses GCC 6.3.0 to compile C/C++ files. make is invoked with -j4 on the command line. The command-line option -flto=4 is being passed to the GCC compiler. The bug goes away if -flto=1 or -flto is used instead of -flto=4.

Is this a make-4.2.1 bug, or a gcc-6.3.0 bug? The line numbers in the garbled error messages, in this case 79 and 84, are correct.

$ make -j4
...
collect2: error: ld returned 1 exit status
make: * [Makefile:84: target1] Error 1
make: * Waiting for unfinished jobs....
...
make: * [Makefile:79: target2] Error 1
...
collect2: error: ld returned 1 exit status
make[1]: * [4
               �:79: target2] Error 1
make[1]: * Waiting for unfinished jobs....
...
collect2: error: ld returned 1 exit status
make[1]: * [4
               �:84: target1] Error 1
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make: * [Makefile:71: tul] Error 1

A line obtained by running /usr/bin/make under /usr/bin/strace is:

execve("/usr/bin/make", ["/usr/bin/make", "-f", "/tmp/ccZfEp7k.mk", "-j4"], [/* 101 vars */] <unfinished ...>

Jan Ziak <atomsymbol>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by gnuser17 (Posted a comment)
  • -email is unavailable- added by jotik (Might be duplicate of https://lists.gnu.org/archive/html/bug-make/2016-11/msg00012.html)
  • -email is unavailable- added by atomsymbol (Submitted the item)
  • -email is unavailable- added by atomsymbol
  •  

    There is 1 vote so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-05-27 psmith StatusNone Duplicate
        Open/ClosedOpen Closed
    2017-04-18 jotik Carbon-Copy- Added -email is unavailable-
    2017-04-12 atomsymbol Carbon-Copy- Added atomsymbol

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code