public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Re: inline-asm/10857: Inlining a function with inline-asm: "error: impossible constraint in `asm'"
@ 2003-05-19 19:37 ehrhardt
  2003-05-21  9:48 ` Bernd Trog
  0 siblings, 1 reply; 5+ messages in thread
From: ehrhardt @ 2003-05-19 19:37 UTC (permalink / raw)
  To: berndtrog, gcc-bugs, gcc-prs, nobody

Synopsis: Inlining a function with inline-asm: "error: impossible constraint in `asm'"

State-Changed-From-To: closed->open
State-Changed-By: cae
State-Changed-When: Mon May 19 17:53:20 2003
State-Changed-Why:
    Reopened based on submitter's comment. This is rejected by 3.3 at all
    optimization levels. I still don't think this should compile but previous
    versions of gcc accepted it. An arch independant example is below. Could
    someone please clarify if this supposed to compile at e.g. -S -O3?
    
    ----------------- cut -------------------------------
    #define PORTD 0x12
    
    static
    void
    write_byte(unsigned char adr, unsigned char data )
    {
    	__asm__ ("blah %0" : : "i" (adr));
    }
    
    int main(void)
    {
    	write_byte( PORTD, 4);
    	return 0;
    }
    ----------------- cut -------------------------------
    
    Both gcc-3.2 and older versions of gcc-3.4 accepted this if
    optimization level was high enough. It is rejected by gcc 3.3
    nomatter what. Note that __builtin_constant_p (adr) holds for
    the inlined copy of write_byte.
    
    The patch the prevented this from compiling at -O3 went into gcc-3.4
    between 20030331 and 20030519.
    
        regards  Christian

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10857


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

* Re: inline-asm/10857: Inlining a function with inline-asm: "error: impossible constraint in `asm'"
  2003-05-19 19:37 inline-asm/10857: Inlining a function with inline-asm: "error: impossible constraint in `asm'" ehrhardt
@ 2003-05-21  9:48 ` Bernd Trog
  0 siblings, 0 replies; 5+ messages in thread
From: Bernd Trog @ 2003-05-21  9:48 UTC (permalink / raw)
  To: jh, ehrhardt, gcc-bugs, gcc-prs, nobody, gcc-gnats

--- ehrhardt@mathematik.uni-ulm.de wrote:
>     The patch the prevented this from compiling at -O3 went into gcc-3.4
>     between 20030331 and 20030519.

After spending some CPU cycles on compiling gcc, it looks like:

+Fri Apr 11 00:12:14 CEST 2003  Jan Hubicka  <jh@suse.cz>
+
+       PR inline-asm/8803
+       * function.c (instantate_virtual_regs):  Verify that all ASM
statements
+       match after the virutal regs instantiation.
+


gcc/gcc/function.c:

          instantiate_virtual_regs_1 (&CALL_INSN_FUNCTION_USAGE (insn),
                                      NULL_RTX, 0);
+       
+       /* Past this point all ASM statements should match.  Verify that
+          to avoid failures later in the compilation process.  */
+        if (asm_noperands (PATTERN (insn)) >= 0
+           && ! check_asm_operands (PATTERN (insn)))
+          instantiate_virtual_regs_lossage (insn);
       }

triggered my regression.

Removing that patch from 3.3.0 makes my code compile
again - I'm happy :-)

Maybe its possible to add another condition to that if statement?






__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com


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

* Re: inline-asm/10857: Inlining a function with inline-asm: "error: impossible constraint in `asm'"
  2003-05-19 12:46 ehrhardt
@ 2003-05-19 17:16 ` Bernd Trog
  0 siblings, 0 replies; 5+ messages in thread
From: Bernd Trog @ 2003-05-19 17:16 UTC (permalink / raw)
  To: ehrhardt, gcc-bugs, gcc-prs, nobody, gcc-gnats

> You can request these optimizations with the various -O
> flags and in this case the code compiles.

Not for me. (gcc-3.3.0, tried: -Os, -O1, -O3) 

Would you please describe your environment?

The code compiles on gcc version 3.3 20030127 (prerelease). (with
inline-asm warnings)







__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com


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

* Re: inline-asm/10857: Inlining a function with inline-asm: "error: impossible constraint in `asm'"
@ 2003-05-19 12:46 ehrhardt
  2003-05-19 17:16 ` Bernd Trog
  0 siblings, 1 reply; 5+ messages in thread
From: ehrhardt @ 2003-05-19 12:46 UTC (permalink / raw)
  To: berndtrog, gcc-bugs, gcc-prs, nobody

Synopsis: Inlining a function with inline-asm: "error: impossible constraint in `asm'"

State-Changed-From-To: open->closed
State-Changed-By: cae
State-Changed-When: Mon May 19 12:23:16 2003
State-Changed-Why:
    Not a bug. An immediate value must be a compile time constant. A
    procedure parameter is definitly NOT a compile time constant. gcc
    can deduce its value for an inline function if certain optimizations
    are done. You can request these optimizations with the various -O
    flags and in this case the code compiles. Note that there is no
    guarantee that this will remain true in the future.
    
    Also note that the `I' constraint has this description on the avr
    architecture:
    
    |    `I'
    |          Constant greater than -1, less than 64
    
         regards  Christian

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10857


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

* inline-asm/10857: Inlining a function with inline-asm: "error: impossible constraint in `asm'"
@ 2003-05-19 12:25 berndtrog
  0 siblings, 0 replies; 5+ messages in thread
From: berndtrog @ 2003-05-19 12:25 UTC (permalink / raw)
  To: gcc-gnats


>Number:         10857
>Category:       inline-asm
>Synopsis:       Inlining a function with inline-asm: "error: impossible constraint in `asm'"
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 19 11:16:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Bernd Trog
>Release:        gcc-3.3.0
>Organization:
>Environment:
avr-gcc -v           
Reading specs from /src/build/gcc-330/lib/gcc-lib/avr/3.3/specs
Configured with: /src/gcc-330/configure -v --target=avr --prefix=/src/build/gcc-330 --with-gnu-ld --with-gnu-as --disable-nls --enable-languages=c,ada
Thread model: single
gcc version 3.3
>Description:
$ avr-gcc  test.c
test.c: In function `write_byte':
test.c:8: warning: asm operand 0 probably doesn't match constraints
test.c:8: error: impossible constraint in `asm'


Note: The information for operand 0 is available 
at compile-time(#define PORTD 0x12)!
>How-To-Repeat:
#define PORTD 0x12

static
inline
void
write_byte( unsigned char adr, unsigned char data )
{
    asm("out %0, %1" : : "I" (adr), "r" (data)  );
}

int main(void)
{
  write_byte( PORTD, 4);

  return 0;
}
>Fix:
unknown
>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2003-05-21  9:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-19 19:37 inline-asm/10857: Inlining a function with inline-asm: "error: impossible constraint in `asm'" ehrhardt
2003-05-21  9:48 ` Bernd Trog
  -- strict thread matches above, loose matches on Subject: below --
2003-05-19 12:46 ehrhardt
2003-05-19 17:16 ` Bernd Trog
2003-05-19 12:25 berndtrog

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).