public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/41294]  New: "=&rm" constraints give overlapping memory addresses
@ 2009-09-07 10:47 jdemeyer at cage dot ugent dot be
  2009-09-07 10:49 ` [Bug inline-asm/41294] " jdemeyer at cage dot ugent dot be
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jdemeyer at cage dot ugent dot be @ 2009-09-07 10:47 UTC (permalink / raw)
  To: gcc-bugs

In some cases in inline asm, an output parameter with no-clobber "=&rm"
constraint gets the same address as an input parameter, even when they refer to
two different C variables.  This seems to happen when the following conditions
are satisfied:

* The variables involved appear only in inline asm (as the output of one asm
statement and the input of a second).
* The output constraint is "=&rm" ("=m" works correctly).
* There are too many clobbered variables forcing some of the output parameters
into memory.

The attached testcase works for i386, x86_64, powerpc and powerpc64.  For other
targets, change the clobber list to include as much registers as possible.
Compile with gcc -O1 -save-temps -c -o bug.o bug.c

Tested with gcc -v:
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc/configure CC=/usr/bin/gcc-4.3.4
--prefix=/home/jdemeyer/local --enable-checking=release
Thread model: posix
gcc version 4.5.0 20090904 (experimental) (GCC)


-- 
           Summary: "=&rm" constraints give overlapping memory addresses
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jdemeyer at cage dot ugent dot be


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


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

* [Bug inline-asm/41294] "=&rm" constraints give overlapping memory addresses
  2009-09-07 10:47 [Bug inline-asm/41294] New: "=&rm" constraints give overlapping memory addresses jdemeyer at cage dot ugent dot be
@ 2009-09-07 10:49 ` jdemeyer at cage dot ugent dot be
  2009-09-07 15:45 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jdemeyer at cage dot ugent dot be @ 2009-09-07 10:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jdemeyer at cage dot ugent dot be  2009-09-07 10:49 -------
Created an attachment (id=18528)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18528&action=view)
Testcase


-- 


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


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

* [Bug inline-asm/41294] "=&rm" constraints give overlapping memory addresses
  2009-09-07 10:47 [Bug inline-asm/41294] New: "=&rm" constraints give overlapping memory addresses jdemeyer at cage dot ugent dot be
  2009-09-07 10:49 ` [Bug inline-asm/41294] " jdemeyer at cage dot ugent dot be
@ 2009-09-07 15:45 ` rguenth at gcc dot gnu dot org
  2009-09-07 19:31 ` jdemeyer at cage dot ugent dot be
  2009-11-21  9:15 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-09-07 15:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2009-09-07 15:45 -------
I think you need to mark both alternatives early-clobber, not only the register
one.  Thus "=&r&m" at least according to the manual.


-- 


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


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

* [Bug inline-asm/41294] "=&rm" constraints give overlapping memory addresses
  2009-09-07 10:47 [Bug inline-asm/41294] New: "=&rm" constraints give overlapping memory addresses jdemeyer at cage dot ugent dot be
  2009-09-07 10:49 ` [Bug inline-asm/41294] " jdemeyer at cage dot ugent dot be
  2009-09-07 15:45 ` rguenth at gcc dot gnu dot org
@ 2009-09-07 19:31 ` jdemeyer at cage dot ugent dot be
  2009-11-21  9:15 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: jdemeyer at cage dot ugent dot be @ 2009-09-07 19:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jdemeyer at cage dot ugent dot be  2009-09-07 19:30 -------
(In reply to comment #2)
> I think you need to mark both alternatives early-clobber, not only the register
> one.  Thus "=&r&m" at least according to the manual.

That doesn't seem to change anything.  It looks to me like the parser only
checks for the presence of at least one "&", since it even accepts "=&&r&&m&&"
(maybe that's another bug?).  On the other hand, using "=&m" as constraint
gives an error
bug.c:141:2: error: '&' constraint used with no register class

According to http://gcc.gnu.org/onlinedocs/gcc/Multi_002dAlternative.html,
the constraint "=&rm" counts as ONE alternative, since alternatives are
seperated by commas.  This is one alternative, allowing both a register or
memory location.


-- 


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


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

* [Bug inline-asm/41294] "=&rm" constraints give overlapping memory addresses
  2009-09-07 10:47 [Bug inline-asm/41294] New: "=&rm" constraints give overlapping memory addresses jdemeyer at cage dot ugent dot be
                   ` (2 preceding siblings ...)
  2009-09-07 19:31 ` jdemeyer at cage dot ugent dot be
@ 2009-11-21  9:15 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-11-21  9:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2009-11-21 09:15 -------


*** This bug has been marked as a duplicate of 37195 ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2009-11-21  9:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-07 10:47 [Bug inline-asm/41294] New: "=&rm" constraints give overlapping memory addresses jdemeyer at cage dot ugent dot be
2009-09-07 10:49 ` [Bug inline-asm/41294] " jdemeyer at cage dot ugent dot be
2009-09-07 15:45 ` rguenth at gcc dot gnu dot org
2009-09-07 19:31 ` jdemeyer at cage dot ugent dot be
2009-11-21  9:15 ` 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).