public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* internal error asm
@ 1998-02-23 15:08 Ulrich Drepper
  1998-02-24  5:07 ` Jeffrey A Law
  0 siblings, 1 reply; 2+ messages in thread
From: Ulrich Drepper @ 1998-02-23 15:08 UTC (permalink / raw)
  To: egcs

Hi,

the following little piece of code crashed all gcc versions on ix86
which I could test:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <stdio.h>

extern double bar (double);

int
baz (double d)
{
  double e = bar (d);
#ifdef BROKEN
  asm volatile ("" : : : "st");
#else
  asm volatile ("" : : : "memory");
#endif
  return printf ("%lg\n", e);
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

drepper@happy drepper$ gcc -Wa,-al -c v.c -O3 -DBROKEN
gcc: Internal compiler error: program cc1 got fatal signal 11

Not defining BROKEN lets the compiler finish but the result is not the
same (I want to force `e' being written to memory before calling
printf).  It's necessary to compile libm correctly.

-- Uli
---------------.      drepper at gnu.org  ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com   `------------------------

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

* Re: internal error asm
  1998-02-23 15:08 internal error asm Ulrich Drepper
@ 1998-02-24  5:07 ` Jeffrey A Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeffrey A Law @ 1998-02-24  5:07 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: egcs

  In message < r2iuq6ggb9.fsf@happy.cygnus.com >you write:
  > Hi,
  > 
  > the following little piece of code crashed all gcc versions on ix86
  > which I could test:
  > 
  > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  > #include <stdio.h>
  > 
  > extern double bar (double);
  > 
  > int
  > baz (double d)
  > {
  >   double e = bar (d);
  > #ifdef BROKEN
  >   asm volatile ("" : : : "st");
  > #else
  >   asm volatile ("" : : : "memory");
  > #endif
  >   return printf ("%lg\n", e);
  > }
Thanks.  It's an x86 specific failure (dies in reg-stack...)

Can you test this patch (both to make sure it fixes the abort *and*
that it doesn't obviously screw up the code -- there's some question
in my mind about what is the proper thing to do in this case.

Index: reg-stack.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/./gcc/reg-stack.c,v
retrieving revision 1.8
diff -c -3 -p -r1.8 reg-stack.c
*** reg-stack.c	1998/02/13 05:40:28	1.8
--- reg-stack.c	1998/02/24 07:28:42
*************** constrain_asm_operands (n_operands, oper
*** 605,610 ****
--- 605,615 ----
    int n_alternatives;
    int j;
  
+   /* If the ASM has no operands, then it must either be alternative zero
+      or "-1" for no alternative matches.  ??? Which is correct?  */
+   if (n_operands == 0)
+     return 0;
+ 
    for (j = 0; j < n_operands; j++)
      constraints[j] = operand_constraints[j];
  

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

end of thread, other threads:[~1998-02-24  5:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-23 15:08 internal error asm Ulrich Drepper
1998-02-24  5:07 ` Jeffrey A Law

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