public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/27134]  New: ICE when compiling vtk-5.0
@ 2006-04-12 12:51 xtv at tveith dot homelinux dot com
  2006-04-12 12:54 ` [Bug c++/27134] " xtv at tveith dot homelinux dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: xtv at tveith dot homelinux dot com @ 2006-04-12 12:51 UTC (permalink / raw)
  To: gcc-bugs

When compiling vtk-5.0 with gcc-4.1.0 there occurs an ICE.. preprocessed
sourcefile attached.


-- 
           Summary: ICE when compiling vtk-5.0
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: xtv at tveith dot homelinux dot com
  GCC host triplet: x86_64-linux-gnu


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


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

* [Bug c++/27134] ICE when compiling vtk-5.0
  2006-04-12 12:51 [Bug c++/27134] New: ICE when compiling vtk-5.0 xtv at tveith dot homelinux dot com
@ 2006-04-12 12:54 ` xtv at tveith dot homelinux dot com
  2006-04-12 14:59 ` [Bug middle-end/27134] [4.1/4.2 regression] ICE with floor and -ffast-math reichelt at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: xtv at tveith dot homelinux dot com @ 2006-04-12 12:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from xtv at tveith dot homelinux dot com  2006-04-12 12:54 -------
Created an attachment (id=11249)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11249&action=view)
preprocessed source file

preprocessed sourcefile compressed with gzip to meet the size requirements for
submitting non-patches to bugzilla


-- 


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


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

* [Bug middle-end/27134] [4.1/4.2 regression] ICE with floor and -ffast-math
  2006-04-12 12:51 [Bug c++/27134] New: ICE when compiling vtk-5.0 xtv at tveith dot homelinux dot com
  2006-04-12 12:54 ` [Bug c++/27134] " xtv at tveith dot homelinux dot com
@ 2006-04-12 14:59 ` reichelt at gcc dot gnu dot org
  2006-04-12 17:54 ` uros at kss-loka dot si
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2006-04-12 14:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from reichelt at gcc dot gnu dot org  2006-04-12 14:59 -------
Confirmed.
Reduced testcase (compile with -O -ffast-math):

======================================================
double floor(double);

inline int bar(double x) { return (int)floor(x); }

int foo(int i) { return bar(i); }
======================================================

bug.c: In function 'foo':
bug.c:3: internal compiler error: in get_callee_fndecl, at tree.c:5809
Please submit a full bug report, [etc.]

Happens with C and C++ frontend.

There seems to be something wrong with -ffast-math and floor.
Renaming floor to something else in the above testcase makes things
work again.


-- 

reichelt at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
          Component|c++                         |middle-end
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-valid-code, monitored
   Last reconfirmed|0000-00-00 00:00:00         |2006-04-12 14:59:12
               date|                            |
            Summary|ICE when compiling vtk-5.0  |[4.1/4.2 regression] ICE
                   |                            |with floor and -ffast-math
   Target Milestone|---                         |4.1.1


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


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

* [Bug middle-end/27134] [4.1/4.2 regression] ICE with floor and -ffast-math
  2006-04-12 12:51 [Bug c++/27134] New: ICE when compiling vtk-5.0 xtv at tveith dot homelinux dot com
  2006-04-12 12:54 ` [Bug c++/27134] " xtv at tveith dot homelinux dot com
  2006-04-12 14:59 ` [Bug middle-end/27134] [4.1/4.2 regression] ICE with floor and -ffast-math reichelt at gcc dot gnu dot org
@ 2006-04-12 17:54 ` uros at kss-loka dot si
  2006-04-14  5:01 ` uros at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: uros at kss-loka dot si @ 2006-04-12 17:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from uros at kss-loka dot si  2006-04-12 17:54 -------
> There seems to be something wrong with -ffast-math and floor.

I have done some analysis on this. Start from expand_builtin_int_roundingfn()
in builtins.c source, where we fallback to FP rounding optab.

fallback_fndecl from mathfn_builtin looks like:

 <function_decl 0x2aaaad992200 __builtin_floor
    type <function_type 0x2aaaad9756e0
        type <real_type 0x2aaaad970420 double DF
            size <integer_cst 0x2aaaad951d80 constant invariant 64>
            unit size <integer_cst 0x2aaaad951db0 constant invariant 8>
            align 64 symtab 0 alias set -1 precision 64
            pointer_to_this <pointer_type 0x2aaaad970630>>
        QI
        size <integer_cst 0x2aaaad9517e0 constant invariant 8>
        unit size <integer_cst 0x2aaaad951810 constant invariant 1>
        align 8 symtab 0 alias set -1
        arg-types <tree_list 0x2aaaad9740f0 value <real_type 0x2aaaad970420
double>
            chain <tree_list 0x2aaaad96be10 value <void_type 0x2aaaad9700b0
void>>>
        pointer_to_this <pointer_type 0x2aaaadabad10>>
    readonly used nothrow public external built-in decl_6 QI file <built-in>
line 0
    built-in BUILT_IN_NORMAL:BUILT_IN_FLOOR attributes <tree_list
0x2aaaad9918d0>
    (mem:QI (symbol_ref:DI ("floor") [flags 0x41] <function_decl 0x2aaaad992200
__builtin_floor>) [0 S1 A8]) chain <function_decl 0x2aaaad992300 floor>>



After that, build_function_call_expr() is called, with an argument list:

 <tree_list 0x2aaaadabf180
    value <float_expr 0x2aaaad95b240
        type <real_type 0x2aaaad970420 double DF
            size <integer_cst 0x2aaaad951d80 constant invariant 64>
            unit size <integer_cst 0x2aaaad951db0 constant invariant 8>
            align 64 symtab 0 alias set -1 precision 64
            pointer_to_this <pointer_type 0x2aaaad970630>>

        arg 0 <parm_decl 0x2aaaad958780 i type <integer_type 0x2aaaad9604d0
int>
            used SI file pr27134.c line 5
            size <integer_cst 0x2aaaad951bd0 constant invariant 32>
            unit size <integer_cst 0x2aaaad9516f0 constant invariant 4>
            align 32 context <function_decl 0x2aaaadaa1600 foo> initial
<integer_type 0x2aaaad9604d0 int>
            (reg/v:SI 59 [ i ]) arg-type <integer_type 0x2aaaad9604d0 int>

This is simplified in fold_build3() to:

 <nop_expr 0x2aaaadac5300
    type <real_type 0x2aaaad970420 double DF
        size <integer_cst 0x2aaaad951d80 constant invariant 64>
        unit size <integer_cst 0x2aaaad951db0 constant invariant 8>
        align 64 symtab 0 alias set -1 precision 64
        pointer_to_this <pointer_type 0x2aaaad970630>>

    arg 0 <float_expr 0x2aaaad95b240 type <real_type 0x2aaaad970420 double>

        arg 0 <parm_decl 0x2aaaad958780 i type <integer_type 0x2aaaad9604d0
int>
            used SI file pr27134.c line 5
            size <integer_cst 0x2aaaad951bd0 constant invariant 32>
            unit size <integer_cst 0x2aaaad9516f0 constant invariant 4>
            align 32 context <function_decl 0x2aaaadaa1600 foo> initial
<integer_type 0x2aaaad9604d0 int>
            (reg/v:SI 59 [ i ]) arg-type <integer_type 0x2aaaad9604d0 int>
            incoming-rtl (reg:SI 5 di [ i ])>>>

It looks to me, that fold_convert3() is trying to kill
(int) __builtin_lfloor ((double) i), where i is an integer argument.

Uros.


-- 

uros at kss-loka dot si changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |uros at kss-loka dot si
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-04-12 14:59:12         |2006-04-12 17:54:41
               date|                            |


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


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

* [Bug middle-end/27134] [4.1/4.2 regression] ICE with floor and -ffast-math
  2006-04-12 12:51 [Bug c++/27134] New: ICE when compiling vtk-5.0 xtv at tveith dot homelinux dot com
                   ` (2 preceding siblings ...)
  2006-04-12 17:54 ` uros at kss-loka dot si
@ 2006-04-14  5:01 ` uros at gcc dot gnu dot org
  2006-04-14  7:18 ` [Bug middle-end/27134] [4.1 " uros at kss-loka dot si
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: uros at gcc dot gnu dot org @ 2006-04-14  5:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from uros at gcc dot gnu dot org  2006-04-14 05:01 -------
Subject: Bug 27134

Author: uros
Date: Fri Apr 14 05:01:18 2006
New Revision: 112949

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=112949
Log:
        PR middle-end/27134
        * builtins.c (expand_builtin_int_roundingfn): Use expand_normal()
        to expand fallback builtin function call.

testsuite/ChangeLog:

        PR middle-end/27134
        * gcc.dg/pr27314.c: New test.


Added:
    trunk/gcc/testsuite/gcc.dg/pr27314.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/builtins.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug middle-end/27134] [4.1 regression] ICE with floor and -ffast-math
  2006-04-12 12:51 [Bug c++/27134] New: ICE when compiling vtk-5.0 xtv at tveith dot homelinux dot com
                   ` (3 preceding siblings ...)
  2006-04-14  5:01 ` uros at gcc dot gnu dot org
@ 2006-04-14  7:18 ` uros at kss-loka dot si
  2006-04-16 11:20 ` uros at gcc dot gnu dot org
  2006-04-16 11:22 ` uros at kss-loka dot si
  6 siblings, 0 replies; 8+ messages in thread
From: uros at kss-loka dot si @ 2006-04-14  7:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from uros at kss-loka dot si  2006-04-14 07:18 -------
Fixed on SVN head.


-- 

uros at kss-loka dot si changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.2.0
            Summary|[4.1/4.2 regression] ICE    |[4.1 regression] ICE with
                   |with floor and -ffast-math  |floor and -ffast-math


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


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

* [Bug middle-end/27134] [4.1 regression] ICE with floor and -ffast-math
  2006-04-12 12:51 [Bug c++/27134] New: ICE when compiling vtk-5.0 xtv at tveith dot homelinux dot com
                   ` (4 preceding siblings ...)
  2006-04-14  7:18 ` [Bug middle-end/27134] [4.1 " uros at kss-loka dot si
@ 2006-04-16 11:20 ` uros at gcc dot gnu dot org
  2006-04-16 11:22 ` uros at kss-loka dot si
  6 siblings, 0 replies; 8+ messages in thread
From: uros at gcc dot gnu dot org @ 2006-04-16 11:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from uros at gcc dot gnu dot org  2006-04-16 11:20 -------
Subject: Bug 27134

Author: uros
Date: Sun Apr 16 11:20:29 2006
New Revision: 112984

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=112984
Log:
        PR middle-end/27134
        * builtins.c (expand_builtin_int_roundingfn): Use expand_expr()
        to expand fallback builtin function call.

gcc/testsuite:

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


Added:
    branches/gcc-4_1-branch/gcc/testsuite/gcc.dg/pr27314.c
Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/builtins.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug middle-end/27134] [4.1 regression] ICE with floor and -ffast-math
  2006-04-12 12:51 [Bug c++/27134] New: ICE when compiling vtk-5.0 xtv at tveith dot homelinux dot com
                   ` (5 preceding siblings ...)
  2006-04-16 11:20 ` uros at gcc dot gnu dot org
@ 2006-04-16 11:22 ` uros at kss-loka dot si
  6 siblings, 0 replies; 8+ messages in thread
From: uros at kss-loka dot si @ 2006-04-16 11:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from uros at kss-loka dot si  2006-04-16 11:22 -------
Fixed.


-- 

uros at kss-loka dot si changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to work|4.2.0                       |4.2.0 4.1.1
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2006-04-16 11:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-12 12:51 [Bug c++/27134] New: ICE when compiling vtk-5.0 xtv at tveith dot homelinux dot com
2006-04-12 12:54 ` [Bug c++/27134] " xtv at tveith dot homelinux dot com
2006-04-12 14:59 ` [Bug middle-end/27134] [4.1/4.2 regression] ICE with floor and -ffast-math reichelt at gcc dot gnu dot org
2006-04-12 17:54 ` uros at kss-loka dot si
2006-04-14  5:01 ` uros at gcc dot gnu dot org
2006-04-14  7:18 ` [Bug middle-end/27134] [4.1 " uros at kss-loka dot si
2006-04-16 11:20 ` uros at gcc dot gnu dot org
2006-04-16 11:22 ` uros at kss-loka dot si

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