This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/49018] New: Inline assembly block executed outside conditional check with "-O1 -ftree-vrp"
- From: "ted at thereisnospork dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 17 May 2011 10:18:53 +0000
- Subject: [Bug tree-optimization/49018] New: Inline assembly block executed outside conditional check with "-O1 -ftree-vrp"
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49018
Summary: Inline assembly block executed outside conditional
check with "-O1 -ftree-vrp"
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: ted@thereisnospork.com
In the following test case, the int3 instruction inserted by the assertion
macro is executed before any conditional check is performed when compiled with
"-O1 -ftree-vrp". Without -ftree-vrp (as well as "-O2 -fno-tree-vrp"), the
instructions are ordered as expected.
$ cat asmvolatiletest.c
#include <stdio.h>
#define CUSTOM_ASSERT( X ) if( !( X ) ) { __asm__ __volatile__ ( "int3" ); }
void testFunction( unsigned int a, unsigned int b )
{
CUSTOM_ASSERT( a >= b );
if( a < b )
{
printf( "Error: %u < %u\n", a, b );
}
}
$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-mandriva-linux-gnu/4.6.0/lto-wrapper
Target: x86_64-mandriva-linux-gnu
Configured with: ./configure --build=x86_64-mandriva-linux-gnu --prefix=/usr
--exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc
--datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64
--libexecdir=/usr/lib64 --localstatedir=/var --sharedstatedir=/usr/com
--mandir=/usr/share/man --infodir=/usr/share/info --x-includes=/usr/include
--x-libraries=/usr/lib64 --disable-libgcj --with-cloog --with-ppl
--enable-cloog-backend=ppl --disable-libssp --disable-libunwind-exceptions
--disable-werror --enable-__cxa_atexit --enable-bootstrap
--enable-checking=release --enable-gnu-unique-object
--enable-languages=c,ada,c++,fortran,go,lto,objc,obj-c++
--enable-linker-build-id --enable-plugin --enable-shared --enable-threads=posix
--with-system-zlib --with-bugurl=https://qa.mandriva.com/ --with-tune=generic
--with-arch_32=i686 --host=x86_64-mandriva-linux-gnu
--target=x86_64-mandriva-linux-gnu
Thread model: posix
gcc version 4.6.0 20110513 (prerelease) (GCC)