public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/43139]  New: ICE in output_operand
@ 2010-02-22 12:12 jakub at gcc dot gnu dot org
  2010-02-23 17:07 ` [Bug target/43139] " jakub at gcc dot gnu dot org
  2010-02-23 17:21 ` jakub at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-02-22 12:12 UTC (permalink / raw)
  To: gcc-bugs

/* { dg-do compile } */
/* { dg-options "-g -O2 -fpic" } */

typedef double T1[10];
typedef double T2[10][10];
typedef int T3[10];
void fn1 (void);
void fn2 (int, ...);

static void
bar (double v, double w, double x, double y, double z)
{
  double a;
  if (v / w < 200.0)
    {
      a = x + (y - x) * __builtin_exp (-v / w);
      fn2 (0);
      fn2 (1, a * 20.2 / z, z);
      fn1 ();
    }
}

static void
baz (T2 u, T2 v, T2 w, T2 x, T1 y, T3 z, double q, int j, int k)
{
  int i = z[k];
  if (u[i][j] > 0.0)
    bar (q, x[i][j], v[i][j], w[i][j], y[i]);
}

static T2 a, b, c, d;
static T1 e;
static T3 f;

void test (int j, int k, double q)
{
  baz (a, b, c, d, e, f, q, j, k);
}

ICEs on redhat/gcc-4_4-branch on i686-linux (and x86_64-linux -m32), with:
internal compiler error: output_operand: invalid expression as operand
I haven't been able to make this testcase ICE on the trunk, but I believe the
issue is just latent there, so I'm filing it here rather than tracking it
internally.

The issue is that %ebx + offset addition is CSEd, so we have:
        leal    (%ebx,%ecx,8), %ecx
...
        fldl    a@GOTOFF(%ecx)
        fldl    c@GOTOFF(%ecx)
        fldl    b@GOTOFF(%ecx)
        fldl    d@GOTOFF(%ecx)
(as this is in a loop, I don't think that is even a bad idea, the code is at
least shorter).  But var-tracking finds out one of the tracked variables lives
in:
(note 189 177 190 4 (var_location w (expr_list:REG_DEP_TRUE (mem/s:DF (plus:SI
(reg:SI 2 cx [75])
            (const:SI (unspec:SI [
                        (symbol_ref:SI ("d") [flags 0x2]  <var_decl
0x7f9bb4c3faa0 d>)
                    ] 1))) [2 S8 A64])
    (const_int 0 [0x0]))) NOTE_INSN_VAR_LOCATION)
and i?86 delegitimize hook, as it doesn't see the PIC register anywhere in the
expression, just gives up.  We don't have a target hook that would verify what
we throw at dw2_asm_output_addr_rtx won't ICE and target's checking ICEs when
it sees an unexpected UNSPEC (or on other targets e.g. might generate invalid
assembly).  So, either we need to add such a target hook which will check the
rtx and tell caller it is not valid (so dwarf2out would just skip that
location), or we need to teach delegitimize langhook in this case to return
some fancy address (in this case it would be (symbol_ref "d") + (reg cx) - (reg
bx)).
Unfortunately the delegitimization langhook is called not just in dwarf2out,
but in other places too, so it needs some verification whether it wouldn't
cause problems there.


-- 
           Summary: ICE in output_operand
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43139


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

* [Bug target/43139] ICE in output_operand
  2010-02-22 12:12 [Bug target/43139] New: ICE in output_operand jakub at gcc dot gnu dot org
@ 2010-02-23 17:07 ` jakub at gcc dot gnu dot org
  2010-02-23 17:21 ` jakub at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-02-23 17:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jakub at gcc dot gnu dot org  2010-02-23 17:06 -------
Subject: Bug 43139

Author: jakub
Date: Tue Feb 23 17:05:56 2010
New Revision: 157011

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157011
Log:
        PR target/43139
        * config/i386/i386.c (ix86_delegitimize_address): Delegitimize all
        GOTOFF relocs, even when the base reg isn't pic pointer.

        * gcc.dg/pr43139.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr43139.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43139


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

* [Bug target/43139] ICE in output_operand
  2010-02-22 12:12 [Bug target/43139] New: ICE in output_operand jakub at gcc dot gnu dot org
  2010-02-23 17:07 ` [Bug target/43139] " jakub at gcc dot gnu dot org
@ 2010-02-23 17:21 ` jakub at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-02-23 17:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2010-02-23 17:21 -------
Fixed.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43139


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

end of thread, other threads:[~2010-02-23 17:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-22 12:12 [Bug target/43139] New: ICE in output_operand jakub at gcc dot gnu dot org
2010-02-23 17:07 ` [Bug target/43139] " jakub at gcc dot gnu dot org
2010-02-23 17:21 ` jakub at gcc dot gnu dot org

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