public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/49018] New: Inline assembly block executed outside conditional check with "-O1 -ftree-vrp"
@ 2011-05-17 10:40 ted at thereisnospork dot com
2011-05-17 11:40 ` [Bug tree-optimization/49018] " rguenth at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: ted at thereisnospork dot com @ 2011-05-17 10:40 UTC (permalink / raw)
To: gcc-bugs
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)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/49018] Inline assembly block executed outside conditional check with "-O1 -ftree-vrp"
2011-05-17 10:40 [Bug tree-optimization/49018] New: Inline assembly block executed outside conditional check with "-O1 -ftree-vrp" ted at thereisnospork dot com
@ 2011-05-17 11:40 ` rguenth at gcc dot gnu.org
2011-05-18 13:57 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-05-17 11:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49018
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2011.05.17 10:50:48
AssignedTo|unassigned at gcc dot |rguenth at gcc dot gnu.org
|gnu.org |
Ever Confirmed|0 |1
--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-17 10:50:48 UTC ---
if-combine is doing this. bb_no_side_effects_p returns true for the
basic-block with the asm.
Mine.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/49018] Inline assembly block executed outside conditional check with "-O1 -ftree-vrp"
2011-05-17 10:40 [Bug tree-optimization/49018] New: Inline assembly block executed outside conditional check with "-O1 -ftree-vrp" ted at thereisnospork dot com
2011-05-17 11:40 ` [Bug tree-optimization/49018] " rguenth at gcc dot gnu.org
@ 2011-05-18 13:57 ` rguenth at gcc dot gnu.org
2011-05-18 14:01 ` rguenth at gcc dot gnu.org
2011-05-18 14:40 ` rguenth at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-05-18 13:57 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49018
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Known to work| |4.6.1, 4.7.0
Resolution| |FIXED
Target Milestone|--- |4.6.1
Known to fail| |4.6.0
--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-18 13:34:25 UTC ---
Fixed.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/49018] Inline assembly block executed outside conditional check with "-O1 -ftree-vrp"
2011-05-17 10:40 [Bug tree-optimization/49018] New: Inline assembly block executed outside conditional check with "-O1 -ftree-vrp" ted at thereisnospork dot com
2011-05-17 11:40 ` [Bug tree-optimization/49018] " rguenth at gcc dot gnu.org
2011-05-18 13:57 ` rguenth at gcc dot gnu.org
@ 2011-05-18 14:01 ` rguenth at gcc dot gnu.org
2011-05-18 14:40 ` rguenth at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-05-18 14:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49018
--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-18 13:33:24 UTC ---
Author: rguenth
Date: Wed May 18 13:33:21 2011
New Revision: 173861
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173861
Log:
2011-05-18 Richard Guenther <rguenther@suse.de>
PR tree-optimization/49018
* gimple.c (gimple_has_side_effects): Volatile asms have side-effects.
* tree-ssa-ifcombine.c (bb_no_side_effects_p): Use
gimple_has_side_effects.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/gimple.c
trunk/gcc/tree-ssa-ifcombine.c
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/49018] Inline assembly block executed outside conditional check with "-O1 -ftree-vrp"
2011-05-17 10:40 [Bug tree-optimization/49018] New: Inline assembly block executed outside conditional check with "-O1 -ftree-vrp" ted at thereisnospork dot com
` (2 preceding siblings ...)
2011-05-18 14:01 ` rguenth at gcc dot gnu.org
@ 2011-05-18 14:40 ` rguenth at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-05-18 14:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49018
--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-18 13:33:56 UTC ---
Author: rguenth
Date: Wed May 18 13:33:53 2011
New Revision: 173862
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173862
Log:
2011-05-18 Richard Guenther <rguenther@suse.de>
PR tree-optimization/49018
* gimple.c (gimple_has_side_effects): Volatile asms have side-effects.
* tree-ssa-ifcombine.c (bb_no_side_effects_p): Use
gimple_has_side_effects.
Modified:
branches/gcc-4_6-branch/gcc/ChangeLog
branches/gcc-4_6-branch/gcc/gimple.c
branches/gcc-4_6-branch/gcc/tree-ssa-ifcombine.c
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-05-18 14:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-17 10:40 [Bug tree-optimization/49018] New: Inline assembly block executed outside conditional check with "-O1 -ftree-vrp" ted at thereisnospork dot com
2011-05-17 11:40 ` [Bug tree-optimization/49018] " rguenth at gcc dot gnu.org
2011-05-18 13:57 ` rguenth at gcc dot gnu.org
2011-05-18 14:01 ` rguenth at gcc dot gnu.org
2011-05-18 14:40 ` rguenth at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).