This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/54529] New: dead code elimination deletes code adressed by referenced labels


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

             Bug #: 54529
           Summary: dead code elimination deletes code adressed by
                    referenced labels
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: Wasserthal@nefkom.net


given the code:

extern void __attribute__((sysv_abi)) breakfree(long long input);

void submaker(long long input)
{
        breakfree(input);
}

void mainloop()
{
    goto skipper;
    ;
    hidden:
        printf("Hello");
    asm("nop; nop; int3; int3; int3; int3; int3; nop; nop; nop; nop");
    asm("ret");
        exit(1);
    skipper:
    submaker(&&hidden);
}

(breakfree is an assembler snippet that sets the basepointer to the one of the
over-overliying function and calls the parameter.)

the problem is that any stuff between ,,hidden'' and ,,skipper'' is removed.

there is no 90 90 CC CC CC CC CC 90 90 90 90 in the resulting elf binary.

Problem: there is no safe work-around because you cannot switch off dead code
elimination even on -O0!
you cannot declare the labels as extern, either.
The problem disappears when you add one calculated goto jump to the function,
but if that should not be taken, it is eliminated, too!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]