public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: target/3506: weird behaviour when incrementing volatile ints
@ 2002-04-03 2:56 Richard Henderson
0 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2002-04-03 2:56 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR target/3506; it has been noted by GNATS.
From: Richard Henderson <rth@redhat.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: rth@gcc.gnu.org, 89949-quiet@bugs.debian.org, gcc-bugs@gcc.gnu.org,
gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Subject: Re: target/3506: weird behaviour when incrementing volatile ints
Date: Wed, 3 Apr 2002 02:47:18 -0800
On Wed, Apr 03, 2002 at 08:29:27PM +1000, Herbert Xu wrote:
> This breaks C99 wrt sig_atomic_t. The increment has to be a single
> instruction.
Um, no, *assignment* has to be a single instruction. Very different.
r~
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: target/3506: weird behaviour when incrementing volatile ints
@ 2002-04-03 2:36 Herbert Xu
0 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2002-04-03 2:36 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR target/3506; it has been noted by GNATS.
From: Herbert Xu <herbert@gondor.apana.org.au>
To: rth@gcc.gnu.org, 89949-quiet@bugs.debian.org, gcc-bugs@gcc.gnu.org,
gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc:
Subject: Re: target/3506: weird behaviour when incrementing volatile ints
Date: Wed, 3 Apr 2002 20:29:27 +1000
On Fri, Mar 29, 2002 at 10:42:35AM -0000, rth@gcc.gnu.org wrote:
> Synopsis: weird behaviour when incrementing volatile ints
>
> State-Changed-From-To: open->closed
> State-Changed-By: rth
> State-Changed-When: Fri Mar 29 02:42:35 2002
> State-Changed-Why:
> GCC doesn't know what constitutes a reference to a volatile memory,
> so it never performs operations on them directly. It will always
> pull the value into a register first.
This breaks C99 wrt sig_atomic_t. The increment has to be a single
instruction.
--
Debian GNU/Linux 2.2 is out! ( http://www.debian.org/ )
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: target/3506: weird behaviour when incrementing volatile ints
@ 2002-03-29 2:42 rth
0 siblings, 0 replies; 4+ messages in thread
From: rth @ 2002-03-29 2:42 UTC (permalink / raw)
To: 89949-quiet, gcc-bugs, gcc-prs, herbert, nobody
Synopsis: weird behaviour when incrementing volatile ints
State-Changed-From-To: open->closed
State-Changed-By: rth
State-Changed-When: Fri Mar 29 02:42:35 2002
State-Changed-Why:
GCC doesn't know what constitutes a reference to a volatile memory,
so it never performs operations on them directly. It will always
pull the value into a register first.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=3506
^ permalink raw reply [flat|nested] 4+ messages in thread
* target/3506: weird behaviour when incrementing volatile ints
@ 2001-07-01 9:06 Matthias Klose
0 siblings, 0 replies; 4+ messages in thread
From: Matthias Klose @ 2001-07-01 9:06 UTC (permalink / raw)
To: gcc-gnats, debian-gcc
>Number: 3506
>Category: target
>Synopsis: weird behaviour when incrementing volatile ints
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: pessimizes-code
>Submitter-Id: net
>Arrival-Date: Sun Jul 01 09:06:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: herbert@gondor.apana.org.au
>Release: 3.0 (Debian GNU/Linux) and HEAD 20010701
>Organization:
The Debian project
>Environment:
System: Debian GNU/Linux (testing/unstable)
Architecture: i686
host: i386-linux
build: i386-linux
target: i386-linux
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
>Description:
[ Reported to the Debian BTS as report #89949.
Please CC 89949-quiet@bugs.debian.org on replies.
Log of report can be found at http://bugs.debian.org/89949 ]
gcc generates non-intuitive code when one tries to increment a volatile int.
extern int x;
extern volatile int y;
void f() {
x++;
y++;
}
The move into %eax seems pointless.
-----------------------------------
gcc-3.0 and gcc CVS HEAD 20010701:
.file "bug-89949.i"
.text
.align 2
.globl f
.type f,@function
f:
pushl %ebp
movl %esp, %ebp
incl x
movl y, %eax
incl %eax
movl %eax, y
popl %ebp
ret
.Lfe1:
.size f,.Lfe1-f
.ident "GCC: (GNU) 3.1 20010701 (experimental)"
-----------------------------------
gcc-3.0 and gcc CVS HEAD 20010701 -O2:
.file "bug-89949.i"
.text
.align 2
.p2align 2,,3
.globl f
.type f,@function
f:
pushl %ebp
movl y, %eax
movl %esp, %ebp
incl %eax
incl x
popl %ebp
movl %eax, y
ret
.Lfe1:
.size f,.Lfe1-f
.ident "GCC: (GNU) 3.1 20010701 (experimental)"
-----------------------------------
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-04-03 10:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-03 2:56 target/3506: weird behaviour when incrementing volatile ints Richard Henderson
-- strict thread matches above, loose matches on Subject: below --
2002-04-03 2:36 Herbert Xu
2002-03-29 2:42 rth
2001-07-01 9:06 Matthias Klose
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).