public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/49855] New: internal compiler error: in fold_convert_const_int_from_real
@ 2011-07-26 17:46 xinliangli at gmail dot com
  2011-09-27 22:23 ` [Bug c++/49855] " navin.kumar at gmail dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: xinliangli at gmail dot com @ 2011-07-26 17:46 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: internal compiler error: in
                    fold_convert_const_int_from_real
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: xinliangli@gmail.com


In the following code, FE should generate FIX_TRUNC_EXPR instead of NOP_EXPR
for the float to int conversion. 

extern void foo(int);

template <class Key, class Value> void Basic() {

  const int kT = 1.5e6;        // <--- causes ICE 
  int size = kT*2/3;        
  do {
    foo(size);
    size = size * 0.5 - 1;
  } while (size >= 0 );

}

Note that removing the template specification, the right code is generated and
there is no ICE.


David


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

* [Bug c++/49855] internal compiler error: in fold_convert_const_int_from_real
  2011-07-26 17:46 [Bug c++/49855] New: internal compiler error: in fold_convert_const_int_from_real xinliangli at gmail dot com
@ 2011-09-27 22:23 ` navin.kumar at gmail dot com
  2011-09-27 22:54 ` [Bug c++/49855] [4.6/4.7 Regression] " paolo.carlini at oracle dot com
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: navin.kumar at gmail dot com @ 2011-09-27 22:23 UTC (permalink / raw)
  To: gcc-bugs

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

Navin Kumar <navin.kumar at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |navin.kumar at gmail dot
                   |                            |com

--- Comment #1 from Navin Kumar <navin.kumar at gmail dot com> 2011-09-27 22:12:50 UTC ---
I have the same problem with gcc 4.6.1;  works fine on gcc 4.5.3


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

* [Bug c++/49855] [4.6/4.7 Regression] internal compiler error: in fold_convert_const_int_from_real
  2011-07-26 17:46 [Bug c++/49855] New: internal compiler error: in fold_convert_const_int_from_real xinliangli at gmail dot com
  2011-09-27 22:23 ` [Bug c++/49855] " navin.kumar at gmail dot com
@ 2011-09-27 22:54 ` paolo.carlini at oracle dot com
  2011-09-28  8:48 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-09-27 22:54 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-09-27
                 CC|                            |jason at gcc dot gnu.org
      Known to work|                            |4.6.0
            Summary|internal compiler error: in |[4.6/4.7 Regression]
                   |fold_convert_const_int_from |internal compiler error: in
                   |_real                       |fold_convert_const_int_from
                   |                            |_real
     Ever Confirmed|0                           |1
      Known to fail|                            |4.6.1, 4.7.0

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-09-27 22:19:52 UTC ---
Oops, apparently this regressed in 4.6.1, 4.6.0 and 4.5.x were fine.


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

* [Bug c++/49855] [4.6/4.7 Regression] internal compiler error: in fold_convert_const_int_from_real
  2011-07-26 17:46 [Bug c++/49855] New: internal compiler error: in fold_convert_const_int_from_real xinliangli at gmail dot com
  2011-09-27 22:23 ` [Bug c++/49855] " navin.kumar at gmail dot com
  2011-09-27 22:54 ` [Bug c++/49855] [4.6/4.7 Regression] " paolo.carlini at oracle dot com
@ 2011-09-28  8:48 ` rguenth at gcc dot gnu.org
  2011-09-28  8:51 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-09-28  8:48 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.6.2

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-09-28 08:19:14 UTC ---
#6  0x000000000071468c in cxx_eval_constant_expression (call=0x0, 
    t=0x2aaaaab38b10, allow_non_constant=1 '\001', addr=0 '\000', 
    non_constant_p=0x7fffffffcbc7 "")
    at /space/rguenther/src/svn/gcc-4_6-branch/gcc/cp/semantics.c:7179
warning: Source file is more recent than executable.
7179              return fold (t);
(gdb) call debug_generic_expr (t)
(int) 1.5e+6

should be a FIX_TRUNC_EXPR not a NOP_EXPR.


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

* [Bug c++/49855] [4.6/4.7 Regression] internal compiler error: in fold_convert_const_int_from_real
  2011-07-26 17:46 [Bug c++/49855] New: internal compiler error: in fold_convert_const_int_from_real xinliangli at gmail dot com
                   ` (2 preceding siblings ...)
  2011-09-28  8:48 ` rguenth at gcc dot gnu.org
@ 2011-09-28  8:51 ` rguenth at gcc dot gnu.org
  2011-10-10 12:11 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-09-28  8:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-09-28 08:21:46 UTC ---
Built via

#4  0x0000000000696c37 in build_nop (type=0x2aaaaab4a498, expr=0x2aaaacef96c0)
    at /space/rguenther/src/svn/gcc-4_6-branch/gcc/cp/typeck.c:4686
#5  0x0000000000590d07 in tsubst_copy_and_build (t=0x2aaaaab38ae0, args=0x0, 
    complain=1, in_decl=0x0, function_p=0 '\000', 
    integral_constant_expression_p=1 '\001')
    at /space/rguenther/src/svn/gcc-4_6-branch/gcc/cp/pt.c:12636
#6  0x00000000005539b4 in fold_non_dependent_expr_sfinae (expr=0x2aaaaab38ae0, 
    complain=1) at /space/rguenther/src/svn/gcc-4_6-branch/gcc/cp/pt.c:5226
#7  0x00000000005539ee in fold_non_dependent_expr (expr=0x2aaaaab38ae0)
    at /space/rguenther/src/svn/gcc-4_6-branch/gcc/cp/pt.c:5240
#8  0x00000000005c5211 in store_init_value (decl=0x2aaaaab561e0, 
    init=0x2aaaacef96c0, flags=11)
    at /space/rguenther/src/svn/gcc-4_6-branch/gcc/cp/typeck2.c:691
#9  0x00000000004ef608 in check_initializer (decl=0x2aaaaab561e0, 
    init=0x2aaaacef96c0, flags=11, cleanup=0x7fffffffd058)
    at /space/rguenther/src/svn/gcc-4_6-branch/gcc/cp/decl.c:5443
#10 0x00000000004f26ae in cp_finish_decl (decl=0x2aaaaab561e0, 
    init=0x2aaaacef96c0, init_const_expr_p=1 '\001', asmspec_tree=0x0, 
    flags=11) at /space/rguenther/src/svn/gcc-4_6-branch/gcc/cp/decl.c:5892


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

* [Bug c++/49855] [4.6/4.7 Regression] internal compiler error: in fold_convert_const_int_from_real
  2011-07-26 17:46 [Bug c++/49855] New: internal compiler error: in fold_convert_const_int_from_real xinliangli at gmail dot com
                   ` (3 preceding siblings ...)
  2011-09-28  8:51 ` rguenth at gcc dot gnu.org
@ 2011-10-10 12:11 ` rguenth at gcc dot gnu.org
  2011-10-11 17:33 ` jason at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-10-10 12:11 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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

* [Bug c++/49855] [4.6/4.7 Regression] internal compiler error: in fold_convert_const_int_from_real
  2011-07-26 17:46 [Bug c++/49855] New: internal compiler error: in fold_convert_const_int_from_real xinliangli at gmail dot com
                   ` (4 preceding siblings ...)
  2011-10-10 12:11 ` rguenth at gcc dot gnu.org
@ 2011-10-11 17:33 ` jason at gcc dot gnu.org
  2011-10-11 17:54 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2011-10-11 17:33 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |


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

* [Bug c++/49855] [4.6/4.7 Regression] internal compiler error: in fold_convert_const_int_from_real
  2011-07-26 17:46 [Bug c++/49855] New: internal compiler error: in fold_convert_const_int_from_real xinliangli at gmail dot com
                   ` (5 preceding siblings ...)
  2011-10-11 17:33 ` jason at gcc dot gnu.org
@ 2011-10-11 17:54 ` jason at gcc dot gnu.org
  2011-10-11 18:20 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2011-10-11 17:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> 2011-10-11 17:53:19 UTC ---
Author: jason
Date: Tue Oct 11 17:53:07 2011
New Revision: 179813

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179813
Log:
    PR c++/49855
    PR c++/49896
    * cp-tree.def (IMPLICIT_CONV_EXPR): New.
    * call.c (perform_implicit_conversion_flags): Build it
    instead of NOP_EXPR.
    * cp-objcp-common.c (cp_common_init_ts): It's typed.
    * cxx-pretty-print.c (pp_cxx_cast_expression): Handle it.
    (pp_cxx_expression): Likewise.
    * error.c (dump_expr): Likewise.
    * semantics.c (potential_constant_expression_1): Likewise.
    * tree.c (cp_tree_equal): Likewise.
    (cp_walk_subtrees): Likewise.
    * pt.c (iterative_hash_template_arg): Likewise.
    (for_each_template_parm_r): Likewise.
    (type_dependent_expression_p): Likewise.
    (tsubst_copy, tsubst_copy_and_build): Handle IMPLICIT_CONV_EXPR
    and CONVERT_EXPR.
    * cp-tree.h (IMPLICIT_CONV_EXPR_DIRECT_INIT): New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-template3.C
    trunk/gcc/testsuite/g++.dg/template/constant1.C
    trunk/gcc/testsuite/g++.dg/template/constant2.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/cp/cp-objcp-common.c
    trunk/gcc/cp/cp-tree.def
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/cxx-pretty-print.c
    trunk/gcc/cp/error.c
    trunk/gcc/cp/pt.c
    trunk/gcc/cp/semantics.c
    trunk/gcc/cp/tree.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/49855] [4.6/4.7 Regression] internal compiler error: in fold_convert_const_int_from_real
  2011-07-26 17:46 [Bug c++/49855] New: internal compiler error: in fold_convert_const_int_from_real xinliangli at gmail dot com
                   ` (6 preceding siblings ...)
  2011-10-11 17:54 ` jason at gcc dot gnu.org
@ 2011-10-11 18:20 ` jason at gcc dot gnu.org
  2011-10-11 18:21 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2011-10-11 18:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> 2011-10-11 18:18:35 UTC ---
Author: jason
Date: Tue Oct 11 18:18:25 2011
New Revision: 179815

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179815
Log:
    PR c++/49855
    PR c++/49896
    * call.c (perform_implicit_conversion_flags): Do perform
    scalar conversions in templates.
    * pt.c (tsubst_copy, tsubst_copy_and_build): Handle CONVERT_EXPR.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/template/constant1.C
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/template/constant2.C
Modified:
    branches/gcc-4_6-branch/gcc/cp/ChangeLog
    branches/gcc-4_6-branch/gcc/cp/call.c
    branches/gcc-4_6-branch/gcc/cp/pt.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog


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

* [Bug c++/49855] [4.6/4.7 Regression] internal compiler error: in fold_convert_const_int_from_real
  2011-07-26 17:46 [Bug c++/49855] New: internal compiler error: in fold_convert_const_int_from_real xinliangli at gmail dot com
                   ` (7 preceding siblings ...)
  2011-10-11 18:20 ` jason at gcc dot gnu.org
@ 2011-10-11 18:21 ` jason at gcc dot gnu.org
  2011-10-24 23:55 ` paolo.carlini at oracle dot com
  2012-01-29  0:16 ` paolo.carlini at oracle dot com
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2011-10-11 18:21 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> 2011-10-11 18:21:00 UTC ---
Fixed for 4.6.2.


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

* [Bug c++/49855] [4.6/4.7 Regression] internal compiler error: in fold_convert_const_int_from_real
  2011-07-26 17:46 [Bug c++/49855] New: internal compiler error: in fold_convert_const_int_from_real xinliangli at gmail dot com
                   ` (8 preceding siblings ...)
  2011-10-11 18:21 ` jason at gcc dot gnu.org
@ 2011-10-24 23:55 ` paolo.carlini at oracle dot com
  2012-01-29  0:16 ` paolo.carlini at oracle dot com
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-24 23:55 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bitbucket at mailinator dot
                   |                            |com

--- Comment #8 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-24 23:54:46 UTC ---
*** Bug 50859 has been marked as a duplicate of this bug. ***


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

* [Bug c++/49855] [4.6/4.7 Regression] internal compiler error: in fold_convert_const_int_from_real
  2011-07-26 17:46 [Bug c++/49855] New: internal compiler error: in fold_convert_const_int_from_real xinliangli at gmail dot com
                   ` (9 preceding siblings ...)
  2011-10-24 23:55 ` paolo.carlini at oracle dot com
@ 2012-01-29  0:16 ` paolo.carlini at oracle dot com
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-01-29  0:16 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |joseph.h.garvin at gmail
                   |                            |dot com

--- Comment #9 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-01-28 23:44:38 UTC ---
*** Bug 52031 has been marked as a duplicate of this bug. ***


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

end of thread, other threads:[~2012-01-28 23:46 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-26 17:46 [Bug c++/49855] New: internal compiler error: in fold_convert_const_int_from_real xinliangli at gmail dot com
2011-09-27 22:23 ` [Bug c++/49855] " navin.kumar at gmail dot com
2011-09-27 22:54 ` [Bug c++/49855] [4.6/4.7 Regression] " paolo.carlini at oracle dot com
2011-09-28  8:48 ` rguenth at gcc dot gnu.org
2011-09-28  8:51 ` rguenth at gcc dot gnu.org
2011-10-10 12:11 ` rguenth at gcc dot gnu.org
2011-10-11 17:33 ` jason at gcc dot gnu.org
2011-10-11 17:54 ` jason at gcc dot gnu.org
2011-10-11 18:20 ` jason at gcc dot gnu.org
2011-10-11 18:21 ` jason at gcc dot gnu.org
2011-10-24 23:55 ` paolo.carlini at oracle dot com
2012-01-29  0:16 ` paolo.carlini at oracle dot com

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