[Bug tree-optimization/56075] [gcc-4.7.1] 64-bit version, -Os eliminate some line of code which working fine in gcc-4.6.2 64-bit version

2013-01-23 Thread rajendiran.public at gmail dot com


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



--- Comment #1 from rajendiran rajendiran.public at gmail dot com 2013-01-23 
10:31:45 UTC ---

Created attachment 29254

  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29254

C Source code without preprocced


[Bug tree-optimization/56075] New: [gcc-4.7.1] 64-bit version, -Os eliminate some line of code which working fine in gcc-4.6.2 64-bit version

2013-01-22 Thread rajendiran.public at gmail dot com


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



 Bug #: 56075

   Summary: [gcc-4.7.1] 64-bit version, -Os eliminate some line of

code which working fine in gcc-4.6.2 64-bit version

Classification: Unclassified

   Product: gcc

   Version: 4.7.1

Status: UNCONFIRMED

  Severity: normal

  Priority: P3

 Component: tree-optimization

AssignedTo: unassig...@gcc.gnu.org

ReportedBy: rajendiran.pub...@gmail.com





Created attachment 29247

  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29247

C source code



With attached sample C codes, assembly code for C code at LINE-1 is not at all

generated in gcc-4.7.1(64-bit) but gcc-4.6.2(64-bit) generate it correctly.



void fun( struct semaphore *s1,struct semaphore *s2)

{

  ...

 { struct semaphore __mutex = { .lock = (spinlock_t ) { { .rlock = { .raw_lock

= { 0 }, .magic = 0xdead4ead, .owner_cpu = -1, .owner = ((void *)-1L), .dep_map

= { .name = (*(s1)).lock } } } }, .count = 1, .wait_list = {

((*(s1)).wait_list), ((*(s1)).wait_list) }, }; *(s1) = __mutex; }; // LINE-1



 { struct semaphore __mutex = { .lock = (spinlock_t ) { { .rlock = { .raw_lock

= { 0 }, .magic = 0xdead4ead, .owner_cpu = -1, .owner = ((void *)-1L), .dep_map

= { .name = (*(s2)).lock } } } }, .count = 1, .wait_list = {

((*(s2)).wait_list), ((*(s2)).wait_list) }, }; *(s2) = __mutex; };  //LINE-2

 ...

}



Source Code Compiling options in GCC-4.7.1

--



gcc -nostdinc -isystem /usr/lib64/gcc/x86_64-unknown-linux-gnu/4.7.1/include

-I/linux-3.1.7-0/kernel/bld/include/

-I/linux-3.1.7-0/kernel/bld/arch/x86/include -Iarch/x86/include/generated

-Iinclude  -include /linux-3.1.7-0/kernel/bld/include/linux/kconfig.h

-D__KERNEL__ -Os -m64 -fno-strict-aliasing -mno-red-zone

-fno-omit-frame-pointer -fconserve-stack -S nv1.c



Source Code Compiling options in GCC-4.6.2

--



gcc -nostdinc -isystem /usr/lib64/gcc/x86_64-suse-linux/4.6/include

-I/linux-3.1.7-0/kernel/bld/include/

-I/linux-3.1.7-0/kernel/bld/arch/x86/include -Iarch/x86/include/generated

-Iinclude  -include /linux-3.1.7-0/kernel/bld/include/linux/kconfig.h

-D__KERNEL__ -Os -m64 -fno-strict-aliasing -mno-red-zone

-fno-omit-frame-pointer -fconserve-stack -S nv1.c





GCC-4.7.1 - Build Config





Using built-in specs.

COLLECT_GCC=gcc

COLLECT_LTO_WRAPPER=/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.1/lto-wrapper

Target: x86_64-unknown-linux-gnu

Configured with: ../gcc-4.7.1/configure --prefix=/tmp/outdir/usr

Thread model: posix

gcc version 4.7.1 (GCC) 







GCC-4.6.2 Build Config

--

Using built-in specs.

COLLECT_GCC=gcc

COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/4.6/lto-wrapper

Target: x86_64-suse-linux

Configured with: ../configure --prefix=/usr --infodir=/usr/share/info

--mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64

--enable-languages=c,c++,objc,fortran,obj-c++,java,ada

--enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.6

--enable-ssp --disable-libssp --disable-plugin

--with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux'

--disable-libgcj --disable-libmudflap --with-slibdir=/lib64 --with-system-zlib

--enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch

--enable-version-specific-runtime-libs --program-suffix=-4.6

--enable-linux-futex --without-system-libunwind --with-arch-32=i586

--with-tune=generic --build=x86_64-suse-linux

Thread model: posix

gcc version 4.6.2 (SUSE Linux)