public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/2597: gcc 3.0 branch rejects legal extended asm
@ 2002-04-23  1:56 rth
  0 siblings, 0 replies; 2+ messages in thread
From: rth @ 2002-04-23  1:56 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, test_alpha

Synopsis: gcc 3.0 branch rejects legal extended asm

State-Changed-From-To: open->closed
State-Changed-By: rth
State-Changed-When: Tue Apr 23 01:56:28 2002
State-Changed-Why:
    Fixed for gcc 3.1.

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


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

* c/2597: gcc 3.0 branch rejects legal extended asm
@ 2001-04-19 21:56 test_alpha
  0 siblings, 0 replies; 2+ messages in thread
From: test_alpha @ 2001-04-19 21:56 UTC (permalink / raw)
  To: gcc-gnats

>Number:         2597
>Category:       c
>Synopsis:       gcc 3.0 branch rejects legal extended asm
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 19 21:56:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Nick
>Release:        gcc version 3.0 20010418 (prerelease)
>Organization:
>Environment:
i386-pc-linux-gnu
>Description:
this version of gcc rejects legal extended asm seemingly when an output/input (+ constraint) operand is negative and could be a register (r, g, etc constraint).
>How-To-Repeat:
try to compile the file - it fails. try commenting out the last 3 printf statements and it works.
>Fix:
do not inline or with the following diff:
        __asm__ (
        "subl   %1, %0\n\t"
-       : "+r"(a)
-       : "r"(b)
+       : "=r"(a)
+       : "r"(b), "0"(a)
        );

        return a;
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="a.c"
Content-Disposition: inline; filename="a.c"

#include <stdio.h>

typedef signed long int32;

/* a - b */
static inline int32 subtract(int32 a, int32 b)
{
	__asm__ (
	"subl	%1, %0\n\t"
	: "+r"(a)
	: "r"(b)
	);

	return a;
}

int main(void)
{
	printf("10 - 5 = %i\n", subtract(10, 5));
	printf("5 - 10 = %i\n", subtract(5, 10));
	printf("-5 - -10 = %i\n", subtract(-5, -10));
	printf("-10 - 5 = %i\n", subtract(-10, 5));

	return 0;
}


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

end of thread, other threads:[~2002-04-23  8:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-23  1:56 c/2597: gcc 3.0 branch rejects legal extended asm rth
  -- strict thread matches above, loose matches on Subject: below --
2001-04-19 21:56 test_alpha

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