Re: inline-asm/10857: Inlining a function with inline-asm: "error: impossible constraint in `asm'"

[email protected]
Newsgroups gmane.comp.gcc.bugs,gmane.comp.gcc.prs
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.