public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/56077] New: volatile ignored when function inlined
@ 2013-01-22 15:59 huntting at glarp dot com
  2013-01-22 22:40 ` [Bug middle-end/56077] " pinskia at gcc dot gnu.org
                   ` (19 more replies)
  0 siblings, 20 replies; 21+ messages in thread
From: huntting at glarp dot com @ 2013-01-22 15:59 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56077
           Summary: volatile ignored when function inlined
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: huntting@glarp.com


The following code snipit produces incorrect code with -fno-schedule-insns2. 
The volatile assignments are incorrectly condensed, but only when the function
is inlined.

I observed similar behavior with the RX port of gcc (KPIT 12.02).


brad

---------------------------


DRACK-1$ cat x.c


static inline void
foo(volatile int *p)
{
    asm("#BEGIN");
    *p = 86;
    *p = 87;
    *p = 88;
    asm("#END");
}

void
bar(void)
{
    volatile int *p = (volatile int *)1234567;
    foo(p);
}
DRACK-1$ gcc -Wall -Wextra -fno-schedule-insns2 -O -c -save-temps /tmp/x.c &&
sed -n '/BEGIN/,/END/p' /tmp/x.s 
        #BEGIN
# 0 "" 2
#NO_APP
        movl    $86, 1234567
        movl    $87, 1234567
        movl    $88, 1234567
#APP
# 10 "/tmp/x.c" 1
        #END
DRACK-1$ gcc -Wall -Wextra -fschedule-insns2 -O -c -save-temps /tmp/x.c && sed
-n '/BEGIN/,/END/p' /tmp/x.s 
        #BEGIN
# 0 "" 2
#NO_APP
        movl    $88, 1234567
#APP
# 10 "/tmp/x.c" 1
        #END
DRACK-1$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.7.2-2ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.7 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object
--enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-2ubuntu1) 
DRACK-1$ cat /tmp/x.i
# 1 "/tmp/x.c"
# 1 "<command-line>"
# 1 "/tmp/x.c"


static inline void
foo(volatile int *p)
{
    asm("#BEGIN");
    *p = 86;
    *p = 87;
    *p = 88;
    asm("#END");
}

void
bar(void)
{
    volatile int *p = (volatile int *)1234567;
    foo(p);
}
DRACK-1$


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

end of thread, other threads:[~2014-06-12 13:21 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-22 15:59 [Bug c/56077] New: volatile ignored when function inlined huntting at glarp dot com
2013-01-22 22:40 ` [Bug middle-end/56077] " pinskia at gcc dot gnu.org
2013-01-22 22:51 ` pinskia at gcc dot gnu.org
2013-01-22 23:14 ` glisse at gcc dot gnu.org
2013-01-22 23:15 ` pinskia at gcc dot gnu.org
2013-01-23 16:34 ` rguenth at gcc dot gnu.org
2013-01-24  0:00 ` huntting at glarp dot com
2013-01-24 12:31 ` [Bug middle-end/56077] [4.6/4.7/4.8 Regression] " jakub at gcc dot gnu.org
2013-02-04 17:25 ` amonakov at gcc dot gnu.org
2013-02-08 15:15 ` rguenth at gcc dot gnu.org
2013-02-18 11:14 ` abel at gcc dot gnu.org
2013-02-25  8:49 ` abel at gcc dot gnu.org
2013-02-25  8:51 ` [Bug middle-end/56077] [4.6/4.7 " abel at gcc dot gnu.org
2013-04-03  5:58 ` abel at gcc dot gnu.org
2013-04-05 21:31 ` ebotcazou at gcc dot gnu.org
2013-04-11  0:38 ` pinskia at gcc dot gnu.org
2013-04-11  5:37 ` jakub at gcc dot gnu.org
2013-04-11  6:17 ` abel at gcc dot gnu.org
2013-04-12 15:18 ` [Bug middle-end/56077] [4.7 " jakub at gcc dot gnu.org
2013-11-22 10:45 ` rguenth at gcc dot gnu.org
2014-06-12 13:21 ` 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).