public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: espenlaub@informatik.uni-ulm.de
To: gcc-gnats@gcc.gnu.org
Subject: other/4932: the i386 backend crashes on incorrect asm("... %c0 ...")
Date: Mon, 19 Nov 2001 11:06:00 -0000	[thread overview]
Message-ID: <20011123094142.23884.qmail@sourceware.cygnus.com> (raw)


>Number:         4932
>Category:       other
>Synopsis:       the i386 backend crashes on incorrect asm("... %c0 ...")
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-illegal-code
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 23 01:46:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Klaus Espenlaub
>Release:        gcc-3.0
>Organization:
>Environment:
System: Linux deadbeef 2.4.4-4GB #2 Fri Jul 20 08:48:42 CEST 2001 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ./configure --enable-languages=c
>Description:
If an asm(...) output pattern contains the `%c' code, but
the actual operand isn't a constant, then the code in
i386.c tries to treat it as a condition code that should
be reversed - and that fails with a SIGSEGV.
>How-To-Repeat:
gcc testcase.c -S testcase.s
>Fix:
--- i386.c-orig	Fri Nov 23 10:29:42 2001
+++ i386.c	Fri Nov 23 10:35:19 2001
@@ -3522,6 +3522,15 @@ print_operand (file, x, code)
 
 	  /* Like above, but reverse condition */
 	case 'c':
+	  /* Buggy user-written assembler instructions may contain this code
+	   * (the user expects the meaning "output constant value without the
+	   * syntax that normally indicates an immediate operand"), but the
+	   * actual operand the compiler uses isn't a constant after all.  */
+	  if (GET_RTX_CLASS (GET_CODE (x)) != '<')
+	    {
+	      output_operand_lossage ("operand is neither a constant nor a condition code, invalid operand code `c'");
+	      return;
+	    }
 	  put_condition_code (GET_CODE (x), GET_MODE (XEXP (x, 0)), 1, 0, file);
 	  return;
 	case 'f':
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="testcase.c"
Content-Disposition: inline; filename="testcase.c"

void *abc;

int main(void)
{
	__asm__ __volatile__("some assembly code containing %c0"
		: /* no output */ : "ir" (abc));
}


             reply	other threads:[~2001-11-23  9:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-19 11:06 espenlaub [this message]
2001-11-21 22:46 rodrigc
2001-11-21 22:46 rodrigc
2001-11-21 23:08 rodrigc
2001-11-21 23:13 rodrigc
2001-12-01  8:49 rodrigc
2001-12-01  8:56 rodrigc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20011123094142.23884.qmail@sourceware.cygnus.com \
    --to=espenlaub@informatik.uni-ulm.de \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).