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 inline-asm/19111] New: Alignment ignored if optimizing for size


Hello,   
   
Please correct me if this is just invalid code, but it compiles and runs   
perfectly when compiled with -O0, -O1, -O2 or when build with intelC...   
   
I've reduced it to this:   
   
int main()   
 {   
  float __attribute__((aligned(16))) aligned_field[4];   
     
   asm   
    (   
     "leal        %0,   %%edx\n" // load pointer to this->data[0]   
     "movaps (%%edx),  %%xmm0\n" // use aligned instruction   
     :   
     :"m"(aligned_field[0])   
     :"edx","xmm0"   
    );   
       
  return 0;   
 }   
  
GDB tells the application crashes in movaps. If I use movups it works with  
-Os. If I do something __productive__ with the data in the field, the -O3  
binary doesn't crash, but I get false results, while -O2 and less work well. 
 
gcc -v says: 
 
Reading specs from /usr/lib/gcc/i686-pc-linux-gnu/3.4.3/specs 
Configured with: /var/tmp/portage/gcc-3.4.3-r1/work/gcc-3.4.3/configure 
--enable-version-specific-runtime-libs --prefix=/usr 
--bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.4.3 
--includedir=/usr/lib/gcc/i686-pc-linux-gnu/3.4.3/include 
--datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.3 
--mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.3/man 
--infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.3/info 
--with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/3.4.3/include/g++-v3 
--host=i686-pc-linux-gnu --disable-altivec --enable-nls 
--without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu 
--with-system-zlib --disable-checking --disable-werror 
--disable-libunwind-exceptions --enable-shared --enable-threads=posix 
--disable-multilib --enable-java-awt=gtk 
--enable-languages=c,c++,f77,objc,java 
Thread model: posix 
gcc version 3.4.3 20041125 (Gentoo Linux 3.4.3-r1, ssp-3.4.3-0, pie-8.7.7)

-- 
           Summary: Alignment ignored if optimizing for size
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: inline-asm
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: alonsoschaich at gmx dot de
                CC: gcc-bugs at gcc dot gnu dot org
 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=19111


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