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 optimization/13552] New: gcc 'optimizes' position of label


Compile this code, with or without '-Os' flag:

#include <string.h>

static int initialStack[1024];

void f()
{
   memcpy( initialStack, &&stackcode, 16 );
   __asm__ volatile ( "jmp *%0" : : "r"(initialStack) : "memory" );
stackcode:
   __asm__ volatile ( "movl %0, %%cr3" :  : "a"(0) : "memory" );
}

In the assembly listing generated with '-Os' the stackcode label (L2) is moved 
to the beginning of the function, instead of the 'movl %0, %%cr3' instruction.
Without '-Os' it works as expected

-- 
           Summary: gcc 'optimizes' position of label
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jbemmel at zonnet dot nl
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: 3.3.1 (mingw32 special 20030804-1)
GCC target triplet: 3.3.1 (mingw32 special 20030804-1)


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


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