Using r153474 with LTO, the compilation units below appear to be improperly
turned into a terminating executable.

reg...@john-home:~$ current-gcc -g -Wall -O3 -flto -c rnd_output0.c
reg...@john-home:~$ current-gcc -g -Wall -O3 -flto -c rnd_output1.c
reg...@john-home:~$ current-gcc -g -Wall -O3 -flto rnd_output1.o rnd_output0.o
-o rand 
reg...@john-home:~$ ./rand
Done
reg...@john-home:~$ 
reg...@john-home:~$ cat rnd_output0.c
#include <assert.h>
#include <stdio.h>

int func_5();

int i = 0;

int func_2()
{
    func_5();
    assert(i == 0);
    assert(i == 0);
    assert(i == 0);
    assert(i == 0);
    assert(i == 0);
    assert(i == 0);
    assert(i == 0);
    return 0;
}

int func_1(int p)
{
    func_2();
    return 0;
}

int main(void)
{
    func_1(func_2());
    printf ("Done\n");
    return 0;
}
reg...@john-home:~$ cat rnd_output1.c
int func_5()
{
    while(1)
      ;
    return 0;
}


-- 
           Summary: possible LTO termination bug
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: regehr at cs dot utah dot edu
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to