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/16551] New: -O2 (-funit-at-a-time) option fails code generation


Using the command line of "gcc -O2 -c test.c" on the following source file:

static short tg_all_8[] __attribute__ ((aligned (16))) = {
    0x0000, 0x0000, 0x0000, 0x0000,     // C1
    0x0001, 0x0001, 0x0001, 0x0001,     // C2
    0x0002, 0x0002, 0x0002, 0x0002,     // C3
    0x0003, 0x0003, 0x0003, 0x0003,     // C4
    0x0004, 0x0004, 0x0004, 0x0004,     // C5
    0x0005, 0x0005, 0x0005, 0x0005,     // C6
    0x0006, 0x0006, 0x0006, 0x0006      // C7
};
                                                                             
void test(short *dct_data, unsigned num_fdcts)
{
    short   *dct;
                                                                             
    __asm__ (
        "pusha\n\t"
        "mov    %[dct], %%eax\n\t"
        "lea    tg_all_8, %%esi\n\t"
        "popa\n\t"
        "emms\n\t"
        :
        : [dct] "m" (dct)
    );
    return;
}

results in a relocatable with the static variable tg_all_8 being undefined.

Additional study shows that the compiler does not generate the assembly code
necessary for defining tg_all_8 when the temporary assembly file is preserved
during the compilation.

All of the options generated by the usage of -O2 where tested and the option
-funit-at-a-time was found to be the one that triggered the error.

A work-around has been found by including the option -no-unit-at-a-time after
the -O2 option has been specified.  This combination results in tg_all_8 being
defined.

-- 
           Summary: -O2 (-funit-at-a-time) option fails code generation
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P1
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rstewart at xvdcorp dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


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