public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/33102]  New: volatile excessively suppresses optimizations in range checks
@ 2007-08-17 23:53 paulmck at linux dot vnet dot ibm dot com
  2007-08-18  0:06 ` [Bug c/33102] " pinskia at gcc dot gnu dot org
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: paulmck at linux dot vnet dot ibm dot com @ 2007-08-17 23:53 UTC (permalink / raw)
  To: gcc-bugs

Source code:
--------------
volatile int i;
int j;

int testme(void)
{
        return i <= 1;
}

int testme2(void)
{
        return j <= 1;
}
--------------
Compiler command line: "cc -S -O torvalds.c"
--------------
Expected results: volatile accesses not moved past sequence points,
optimization otherwise unaffected.
--------------
Observed results: redundant move to register generated, unecessarily increasing
register pressure, increasing the size of the binary, and potentially consuming
more power and decreasing performance.
--------------
Build date and platform: August 17 2007 Ubuntu Feisty Fawn.
--------------
gcc -v output:
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-mpfr --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.2 (Ubuntu 4.1.2-0ubuntu4)
--------------
Code generated to compare volatile variable to constant:
        movl    i, %eax
        cmpl    $1, %eax
Code generated to compare non-volatile variable to constant:
        cmpl    $1, j
The latter code sequence should be generated for the volatile case as well as
the non-volatile case.  Similar inefficiencies are produced in response to
other uses of volatile variables.


-- 
           Summary: volatile excessively suppresses optimizations in range
                    checks
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: paulmck at linux dot vnet dot ibm dot com
 GCC build triplet: i486-linux-gnu
  GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu


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


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2008-12-28  2:51 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-17 23:53 [Bug c/33102] New: volatile excessively suppresses optimizations in range checks paulmck at linux dot vnet dot ibm dot com
2007-08-18  0:06 ` [Bug c/33102] " pinskia at gcc dot gnu dot org
2007-08-18  0:11 ` paulmck at linux dot vnet dot ibm dot com
2007-08-18  0:12 ` segher at kernel dot crashing dot org
2007-08-18  0:13 ` pinskia at gcc dot gnu dot org
2007-08-18  0:32 ` segher at kernel dot crashing dot org
2007-08-18  1:04 ` paulmck at linux dot vnet dot ibm dot com
2007-08-18  1:10 ` [Bug middle-end/33102] " pinskia at gcc dot gnu dot org
2007-08-18  1:11 ` pinskia at gcc dot gnu dot org
2007-08-18  1:12 ` pinskia at gcc dot gnu dot org
2007-08-18  1:13 ` pinskia at gcc dot gnu dot org
2007-08-18  1:21 ` paulmck at linux dot vnet dot ibm dot com
2007-08-18  1:23 ` paulmck at linux dot vnet dot ibm dot com
2007-08-18  1:26 ` pinskia at gcc dot gnu dot org
2007-08-18 22:09 ` paulmck at linux dot vnet dot ibm dot com
2007-08-18 22:12 ` paulmck at linux dot vnet dot ibm dot com
2008-12-28  2:51 ` pinskia at gcc dot gnu dot 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).