public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/23200] New: [4.0 regress] rejects "i"(&var + 1)
@ 2005-08-02 15:18 stsp at users dot sourceforge dot net
  2005-08-02 15:24 ` [Bug inline-asm/23200] [4.0/4.1 regression] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: stsp at users dot sourceforge dot net @ 2005-08-02 15:18 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1441 bytes --]

Hi.

The following code, that used to compile on the older gcc,
now rejects:

---
static char var;
int main()
{
  asm volatile ("" :: "i"(&var + 1));
  return 0;
}
---

with the following message:
---
asc.c:5: warning: asm operand 0 probably doesn’t match constraints
asc.c:5: error: impossible constraint in ‘asm’
---

Changing "+1" to "+0" makes it to compile again.

Here is the info on my gcc:

$ gcc -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --host=i386-redhat-linux
Thread model: posix
gcc version 4.0.1 20050714 (Red Hat 4.0.1-3)

-- 
           Summary: [4.0 regress] rejects "i"(&var + 1)
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: inline-asm
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: stsp at users dot sourceforge dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: x86
  GCC host triplet: x86
GCC target triplet: x86


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


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

* [Bug inline-asm/23200] [4.0/4.1 regression] rejects "i"(&var + 1)
  2005-08-02 15:18 [Bug inline-asm/23200] New: [4.0 regress] rejects "i"(&var + 1) stsp at users dot sourceforge dot net
@ 2005-08-02 15:24 ` pinskia at gcc dot gnu dot org
  2005-08-02 20:57 ` rth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-02 15:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-02 15:24 -------
Hmm, somone else have to verify if this valid or invalid code.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  GCC build triplet|x86                         |
   GCC host triplet|x86                         |
 GCC target triplet|x86                         |
           Keywords|                            |rejects-valid
      Known to fail|                            |4.0.0 4.1.0
      Known to work|                            |3.4.0
            Summary|[4.0 regress] rejects       |[4.0/4.1 regression] rejects
                   |"i"(&var + 1)               |"i"(&var + 1)
   Target Milestone|---                         |4.0.2


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


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

* [Bug inline-asm/23200] [4.0/4.1 regression] rejects "i"(&var + 1)
  2005-08-02 15:18 [Bug inline-asm/23200] New: [4.0 regress] rejects "i"(&var + 1) stsp at users dot sourceforge dot net
  2005-08-02 15:24 ` [Bug inline-asm/23200] [4.0/4.1 regression] " pinskia at gcc dot gnu dot org
@ 2005-08-02 20:57 ` rth at gcc dot gnu dot org
  2005-08-04 22:03 ` rth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-08-02 20:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2005-08-02 20:57 -------
I think it's valid.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rth at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-08-02 20:57:12
               date|                            |


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


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

* [Bug inline-asm/23200] [4.0/4.1 regression] rejects "i"(&var + 1)
  2005-08-02 15:18 [Bug inline-asm/23200] New: [4.0 regress] rejects "i"(&var + 1) stsp at users dot sourceforge dot net
  2005-08-02 15:24 ` [Bug inline-asm/23200] [4.0/4.1 regression] " pinskia at gcc dot gnu dot org
  2005-08-02 20:57 ` rth at gcc dot gnu dot org
@ 2005-08-04 22:03 ` rth at gcc dot gnu dot org
  2005-08-04 22:12 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-08-04 22:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2005-08-04 22:03 -------
Andrew, can you have a look at why this isn't being TER'ed back into the
asm_expr?  It's not a 100% ideal solution to this problem, but I'll guess
that it'll handle at least some of the cases including this one.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amacleod at redhat dot com
         AssignedTo|rth at gcc dot gnu dot org  |unassigned at gcc dot gnu
                   |                            |dot org
             Status|ASSIGNED                    |NEW


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


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

* [Bug inline-asm/23200] [4.0/4.1 regression] rejects "i"(&var + 1)
  2005-08-02 15:18 [Bug inline-asm/23200] New: [4.0 regress] rejects "i"(&var + 1) stsp at users dot sourceforge dot net
                   ` (2 preceding siblings ...)
  2005-08-04 22:03 ` rth at gcc dot gnu dot org
@ 2005-08-04 22:12 ` pinskia at gcc dot gnu dot org
  2005-08-05 20:43 ` rth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-04 22:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-04 22:11 -------
TER will not work at -O0 though.

-- 


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


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

* [Bug inline-asm/23200] [4.0/4.1 regression] rejects "i"(&var + 1)
  2005-08-02 15:18 [Bug inline-asm/23200] New: [4.0 regress] rejects "i"(&var + 1) stsp at users dot sourceforge dot net
                   ` (3 preceding siblings ...)
  2005-08-04 22:12 ` pinskia at gcc dot gnu dot org
@ 2005-08-05 20:43 ` rth at gcc dot gnu dot org
  2005-08-08 18:14 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-08-05 20:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2005-08-05 20:43 -------
Then it'll stay broken at -O0 until we completely rewrite rtl expansion.
There are really very few ways around this problem...

-- 


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


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

* [Bug inline-asm/23200] [4.0/4.1 regression] rejects "i"(&var + 1)
  2005-08-02 15:18 [Bug inline-asm/23200] New: [4.0 regress] rejects "i"(&var + 1) stsp at users dot sourceforge dot net
                   ` (4 preceding siblings ...)
  2005-08-05 20:43 ` rth at gcc dot gnu dot org
@ 2005-08-08 18:14 ` pinskia at gcc dot gnu dot org
  2005-08-15 17:18 ` amacleod at redhat dot com
  2005-09-27 16:06 ` mmitchel at gcc dot gnu dot org
  7 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-08 18:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-08 18:14 -------
: Search converges between 2004-05-11-trunk (#454) and 2004-05-14-trunk (#455).



-- 


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


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

* [Bug inline-asm/23200] [4.0/4.1 regression] rejects "i"(&var + 1)
  2005-08-02 15:18 [Bug inline-asm/23200] New: [4.0 regress] rejects "i"(&var + 1) stsp at users dot sourceforge dot net
                   ` (5 preceding siblings ...)
  2005-08-08 18:14 ` pinskia at gcc dot gnu dot org
@ 2005-08-15 17:18 ` amacleod at redhat dot com
  2005-09-27 16:06 ` mmitchel at gcc dot gnu dot org
  7 siblings, 0 replies; 13+ messages in thread
From: amacleod at redhat dot com @ 2005-08-15 17:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From amacleod at redhat dot com  2005-08-15 17:15 -------
TER isnt doing anything with this because there are no virtual operands. It sees:

  # BLOCK 0
  # PRED: ENTRY [100.0%]  (fallthru,exec)
  D.1279 = &var + 1B;
  __asm__ __volatile__(""::"i" D.1279);
  return 0;


so the stmt:
  D.1279 = &var + 1B;

isnt considered for replacvement since there are no dependancies whatsoever on
it. TER operates on the assumptions that if a stmt has no USES and no VUSES,
then one of the other optimizations would have done the substitution if it were
possible. 

There use to be a good reason for this, and there was a comment to that effect,
but it seems to have been removed. Perhaps the original reason is gone, but the
code hasnt been properly updated to fix the issue.

A quick hack to TER to add a "NO_DEPEND_PARTITION" for such statements appears
to do what you are looking for here:
  # BLOCK 0
  # PRED: ENTRY [100.0%]  (fallthru,exec)
  __asm__ __volatile__(""::"i" &var + 1B);
  return 0;

I will run it through the test suites to see if it reintroduces whatever
the original problem with these types of replacements was.




-- 


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


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

* [Bug inline-asm/23200] [4.0/4.1 regression] rejects "i"(&var + 1)
  2005-08-02 15:18 [Bug inline-asm/23200] New: [4.0 regress] rejects "i"(&var + 1) stsp at users dot sourceforge dot net
                   ` (6 preceding siblings ...)
  2005-08-15 17:18 ` amacleod at redhat dot com
@ 2005-09-27 16:06 ` mmitchel at gcc dot gnu dot org
  7 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-09-27 16:06 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.2                       |4.0.3


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


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

* [Bug inline-asm/23200] [4.0/4.1 regression] rejects "i"(&var + 1)
       [not found] <bug-23200-11104@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2005-11-11  8:59 ` bonzini at gcc dot gnu dot org
@ 2005-11-11  9:00 ` bonzini at gcc dot gnu dot org
  3 siblings, 0 replies; 13+ messages in thread
From: bonzini at gcc dot gnu dot org @ 2005-11-11  9:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from bonzini at gcc dot gnu dot org  2005-11-11 09:00 -------
CCing dberlin as he was the author of the pointer->array patch.


-- 

bonzini at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dberlin at gcc dot gnu dot
                   |                            |org


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


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

* [Bug inline-asm/23200] [4.0/4.1 regression] rejects "i"(&var + 1)
       [not found] <bug-23200-11104@http.gcc.gnu.org/bugzilla/>
  2005-10-29 15:11 ` steven at gcc dot gnu dot org
  2005-10-31  4:37 ` mmitchel at gcc dot gnu dot org
@ 2005-11-11  8:59 ` bonzini at gcc dot gnu dot org
  2005-11-11  9:00 ` bonzini at gcc dot gnu dot org
  3 siblings, 0 replies; 13+ messages in thread
From: bonzini at gcc dot gnu dot org @ 2005-11-11  8:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from bonzini at gcc dot gnu dot org  2005-11-11 08:59 -------
Could the patch to lower pointer arithmetic to array arithmetic help?

typedef int int_array[];
typedef int_array *p_int_array;

int var;

void f()
{
  asm volatile ("" :: "i"(&(*(p_int_array)&var)[1]));
}


does not work too, but it looks like if the compiler did this lowering, it
would be valid GIMPLE and there would be no need to create the temporary.

And this would be doable at -O0 too.


-- 


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


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

* [Bug inline-asm/23200] [4.0/4.1 regression] rejects "i"(&var + 1)
       [not found] <bug-23200-11104@http.gcc.gnu.org/bugzilla/>
  2005-10-29 15:11 ` steven at gcc dot gnu dot org
@ 2005-10-31  4:37 ` mmitchel at gcc dot gnu dot org
  2005-11-11  8:59 ` bonzini at gcc dot gnu dot org
  2005-11-11  9:00 ` bonzini at gcc dot gnu dot org
  3 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-10-31  4:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from mmitchel at gcc dot gnu dot org  2005-10-31 04:37 -------
Leaving as P2.


-- 


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


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

* [Bug inline-asm/23200] [4.0/4.1 regression] rejects "i"(&var + 1)
       [not found] <bug-23200-11104@http.gcc.gnu.org/bugzilla/>
@ 2005-10-29 15:11 ` steven at gcc dot gnu dot org
  2005-10-31  4:37 ` mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 13+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-10-29 15:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from steven at gcc dot gnu dot org  2005-10-29 15:11 -------
I'm testing the patch from comment #8 on a few targets.


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2005-08-02 20:57:12         |2005-10-29 15:11:43
               date|                            |


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


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

end of thread, other threads:[~2005-11-11  9:00 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-02 15:18 [Bug inline-asm/23200] New: [4.0 regress] rejects "i"(&var + 1) stsp at users dot sourceforge dot net
2005-08-02 15:24 ` [Bug inline-asm/23200] [4.0/4.1 regression] " pinskia at gcc dot gnu dot org
2005-08-02 20:57 ` rth at gcc dot gnu dot org
2005-08-04 22:03 ` rth at gcc dot gnu dot org
2005-08-04 22:12 ` pinskia at gcc dot gnu dot org
2005-08-05 20:43 ` rth at gcc dot gnu dot org
2005-08-08 18:14 ` pinskia at gcc dot gnu dot org
2005-08-15 17:18 ` amacleod at redhat dot com
2005-09-27 16:06 ` mmitchel at gcc dot gnu dot org
     [not found] <bug-23200-11104@http.gcc.gnu.org/bugzilla/>
2005-10-29 15:11 ` steven at gcc dot gnu dot org
2005-10-31  4:37 ` mmitchel at gcc dot gnu dot org
2005-11-11  8:59 ` bonzini at gcc dot gnu dot org
2005-11-11  9:00 ` bonzini 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).