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 rtl-optimization/15421] New: -O2 (and above) optimize away used variables resulting in 'undefined reference'


gcc-3.4.0 and gcc-3.5.0_20040502 can only compile the
following file with up to -O1 and cant with -O2 or above.
With -O2, the used variable 'a' is optimized away. Source
is extracted from libmpeg3-1.5.4:

$>cat o2bug.c
static long long a = 0x7f7f7f7f7f7f7f7fLL;
static inline void b(char *c)
{
 __asm__ (
  "movq  a,   %%mm1\n"
  :
  :"c" (c)
 );
}
int main() { char c[8]; b(c); }

$>gcc -O2 o2bug.c
/tmp/cci14X25.o(.text+0x12): In function `main':
: undefined reference to `a'
collect2: ld returned 1 exit status

$>gcc -O1 o2bug.c

$>

-- 
           Summary: -O2 (and above) optimize away used variables resulting
                    in 'undefined reference'
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dueffert at informatik dot hu-berlin dot de
                CC: gcc-bugs at gcc dot gnu dot org


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


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