public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/28349]  New: [4.0/4.1/4.2 regression] ICE with va_arg
@ 2006-07-11 16:29 reichelt at gcc dot gnu dot org
  2006-07-11 16:30 ` [Bug c++/28349] " reichelt at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2006-07-11 16:29 UTC (permalink / raw)
  To: gcc-bugs

The following valid (though questionable) code snippet triggers an ICE
since GCC 3.1:

=========================================
#include <stdarg.h>

void foo(int, ...)
{
    va_list va;
    int i;
    i = va_arg(va, int&);
}
=========================================

bug.cc: In function 'void foo(int, ...)':
bug.cc:7: warning: cannot receive objects of non-POD type 'int&' through '...';
call will abort at runtime
bug.cc:7: internal compiler error: in build_modify_expr, at cp/typeck.c:5643
Please submit a full bug report, [etc.]


-- 
           Summary: [4.0/4.1/4.2 regression] ICE with va_arg
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code, monitored
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org


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


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

* [Bug c++/28349] [4.0/4.1/4.2 regression] ICE with va_arg
  2006-07-11 16:29 [Bug c++/28349] New: [4.0/4.1/4.2 regression] ICE with va_arg reichelt at gcc dot gnu dot org
@ 2006-07-11 16:30 ` reichelt at gcc dot gnu dot org
  2006-07-13 23:46 ` [Bug c++/28349] [4.0/4.1/4.2 regression] ICE with "undefined" va_arg and references pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2006-07-11 16:30 UTC (permalink / raw)
  To: gcc-bugs



-- 

reichelt at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.0.4


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


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

* [Bug c++/28349] [4.0/4.1/4.2 regression] ICE with "undefined" va_arg and references
  2006-07-11 16:29 [Bug c++/28349] New: [4.0/4.1/4.2 regression] ICE with va_arg reichelt at gcc dot gnu dot org
  2006-07-11 16:30 ` [Bug c++/28349] " reichelt at gcc dot gnu dot org
@ 2006-07-13 23:46 ` pinskia at gcc dot gnu dot org
  2006-07-17  3:14 ` mmitchel at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-07-13 23:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-07-13 23:46 -------
Confirmed, we should not ICE on undefined code.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-07-13 23:46:13
               date|                            |
            Summary|[4.0/4.1/4.2 regression] ICE|[4.0/4.1/4.2 regression] ICE
                   |with va_arg                 |with "undefined" va_arg and
                   |                            |references


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


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

* [Bug c++/28349] [4.0/4.1/4.2 regression] ICE with "undefined" va_arg and references
  2006-07-11 16:29 [Bug c++/28349] New: [4.0/4.1/4.2 regression] ICE with va_arg reichelt at gcc dot gnu dot org
  2006-07-11 16:30 ` [Bug c++/28349] " reichelt at gcc dot gnu dot org
  2006-07-13 23:46 ` [Bug c++/28349] [4.0/4.1/4.2 regression] ICE with "undefined" va_arg and references pinskia at gcc dot gnu dot org
@ 2006-07-17  3:14 ` mmitchel at gcc dot gnu dot org
  2006-08-27 23:12 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-07-17  3:14 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/28349] [4.0/4.1/4.2 regression] ICE with "undefined" va_arg and references
  2006-07-11 16:29 [Bug c++/28349] New: [4.0/4.1/4.2 regression] ICE with va_arg reichelt at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2006-07-17  3:14 ` mmitchel at gcc dot gnu dot org
@ 2006-08-27 23:12 ` pinskia at gcc dot gnu dot org
  2006-08-27 23:23 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-08-27 23:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-08-27 23:12 -------
I have a simple fix.


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/28349] [4.0/4.1/4.2 regression] ICE with "undefined" va_arg and references
  2006-07-11 16:29 [Bug c++/28349] New: [4.0/4.1/4.2 regression] ICE with va_arg reichelt at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2006-08-27 23:12 ` pinskia at gcc dot gnu dot org
@ 2006-08-27 23:23 ` pinskia at gcc dot gnu dot org
  2006-08-30  4:33 ` [Bug c++/28349] [4.0/4.1 " pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-08-27 23:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2006-08-27 23:23 -------
The patch which I am testing:
Index: call.c
===================================================================
--- call.c      (revision 116493)
+++ call.c      (working copy)
@@ -4544,10 +4544,12 @@ build_x_va_arg (tree expr, tree type)

   if (! pod_type_p (type))
     {
+      /* Remove reference types so we don't ICE later on.  */
+      tree type1 = non_reference (type);
       /* Undefined behavior [expr.call] 5.2.2/7.  */
       warning (0, "cannot receive objects of non-POD type %q#T through
%<...%>; "
               "call will abort at runtime", type);
-      expr = convert (build_pointer_type (type), null_node);
+      expr = convert (build_pointer_type (type1), null_node);
       expr = build2 (COMPOUND_EXPR, TREE_TYPE (expr),
                     call_builtin_trap (), expr);
       expr = build_indirect_ref (expr, NULL);

-------
Since we already build a pointer type, we don't need use the reference type.


-- 


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


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

* [Bug c++/28349] [4.0/4.1/4.2 regression] ICE with "undefined" va_arg and references
  2006-07-11 16:29 [Bug c++/28349] New: [4.0/4.1/4.2 regression] ICE with va_arg reichelt at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2006-08-30  4:33 ` [Bug c++/28349] [4.0/4.1 " pinskia at gcc dot gnu dot org
@ 2006-08-30  4:33 ` pinskia at gcc dot gnu dot org
  2006-10-06  2:48 ` [Bug c++/28349] [4.0 " pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-08-30  4:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2006-08-30 04:33 -------
Subject: Bug 28349

Author: pinskia
Date: Wed Aug 30 04:33:10 2006
New Revision: 116577

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116577
Log:
2006-08-29  Andrew Pinski  <pinskia@physics.uc.edu>

        PR c++/28349
        * testsuite/g++.dg/warn/var-args1.C: New test.
2006-08-29  Andrew Pinski  <pinskia@physics.uc.edu>

        PR C++/28349
        * call.c (build_x_va_arg): Remove the reference type
        from the type before creating the pointer type.


Added:
    trunk/gcc/testsuite/g++.dg/warn/var-args1.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/28349] [4.0/4.1 regression] ICE with "undefined" va_arg and references
  2006-07-11 16:29 [Bug c++/28349] New: [4.0/4.1/4.2 regression] ICE with va_arg reichelt at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2006-08-27 23:23 ` pinskia at gcc dot gnu dot org
@ 2006-08-30  4:33 ` pinskia at gcc dot gnu dot org
  2006-08-30  4:33 ` [Bug c++/28349] [4.0/4.1/4.2 " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-08-30  4:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2006-08-30 04:33 -------
Fixed on the mainline, will most likely Apply this patch to the 4.1 branch this
long weekend.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.0/4.1/4.2 regression] ICE|[4.0/4.1 regression] ICE
                   |with "undefined" va_arg and |with "undefined" va_arg and
                   |references                  |references


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


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

* [Bug c++/28349] [4.0 regression] ICE with "undefined" va_arg and references
  2006-07-11 16:29 [Bug c++/28349] New: [4.0/4.1/4.2 regression] ICE with va_arg reichelt at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2006-08-30  4:33 ` [Bug c++/28349] [4.0/4.1/4.2 " pinskia at gcc dot gnu dot org
@ 2006-10-06  2:48 ` pinskia at gcc dot gnu dot org
  2006-10-06  2:51 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-10-06  2:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2006-10-06 02:48 -------
Fixed also on the 4.1 branch now.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.1.2 4.2.0
            Summary|[4.0/4.1 regression] ICE    |[4.0 regression] ICE with
                   |with "undefined" va_arg and |"undefined" va_arg and
                   |references                  |references


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


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

* [Bug c++/28349] [4.0 regression] ICE with "undefined" va_arg and references
  2006-07-11 16:29 [Bug c++/28349] New: [4.0/4.1/4.2 regression] ICE with va_arg reichelt at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2006-10-06  2:48 ` [Bug c++/28349] [4.0 " pinskia at gcc dot gnu dot org
@ 2006-10-06  2:51 ` pinskia at gcc dot gnu dot org
  2006-10-10  4:38 ` pinskia at gcc dot gnu dot org
  2006-10-10  4:38 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-10-06  2:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2006-10-06 02:51 -------
Subject: Bug 28349

Author: pinskia
Date: Fri Oct  6 02:51:33 2006
New Revision: 117479

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117479
Log:
2006-10-05  Andrew Pinski  <pinskia@physics.uc.edu>

        PR C++/28349
        * call.c (build_x_va_arg): Remove the reference type
        from the type before creating the pointer type.


2006-10-05  Andrew Pinski  <pinskia@physics.uc.edu>

        PR c++/28349
        * testsuite/g++.dg/warn/var-args1.C: New test.



Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/warn/var-args1.C
      - copied unchanged from r116577,
trunk/gcc/testsuite/g++.dg/warn/var-args1.C
Modified:
    branches/gcc-4_1-branch/gcc/cp/ChangeLog
    branches/gcc-4_1-branch/gcc/cp/call.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/28349] [4.0 regression] ICE with "undefined" va_arg and references
  2006-07-11 16:29 [Bug c++/28349] New: [4.0/4.1/4.2 regression] ICE with va_arg reichelt at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2006-10-10  4:38 ` pinskia at gcc dot gnu dot org
@ 2006-10-10  4:38 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-10-10  4:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pinskia at gcc dot gnu dot org  2006-10-10 04:38 -------
Fixed.


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/28349] [4.0 regression] ICE with "undefined" va_arg and references
  2006-07-11 16:29 [Bug c++/28349] New: [4.0/4.1/4.2 regression] ICE with va_arg reichelt at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2006-10-06  2:51 ` pinskia at gcc dot gnu dot org
@ 2006-10-10  4:38 ` pinskia at gcc dot gnu dot org
  2006-10-10  4:38 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-10-10  4:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pinskia at gcc dot gnu dot org  2006-10-10 04:38 -------
Subject: Bug 28349

Author: pinskia
Date: Tue Oct 10 04:38:25 2006
New Revision: 117595

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117595
Log:
2006-10-09  Andrew Pinski  <pinskia@physics.uc.edu>

        PR C++/28349
        * call.c (build_x_va_arg): Remove the reference type
        from the type before creating the pointer type.

2006-10-09  Andrew Pinski  <pinskia@physics.uc.edu>

        PR c++/28349
        * testsuite/g++.dg/warn/var-args1.C: New test


Added:
    branches/gcc-4_0-branch/gcc/testsuite/g++.dg/warn/var-args1.C
      - copied unchanged from r116577,
trunk/gcc/testsuite/g++.dg/warn/var-args1.C
Modified:
    branches/gcc-4_0-branch/gcc/cp/ChangeLog
    branches/gcc-4_0-branch/gcc/cp/call.c
    branches/gcc-4_0-branch/gcc/testsuite/ChangeLog


-- 


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


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

end of thread, other threads:[~2006-10-10  4:38 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-11 16:29 [Bug c++/28349] New: [4.0/4.1/4.2 regression] ICE with va_arg reichelt at gcc dot gnu dot org
2006-07-11 16:30 ` [Bug c++/28349] " reichelt at gcc dot gnu dot org
2006-07-13 23:46 ` [Bug c++/28349] [4.0/4.1/4.2 regression] ICE with "undefined" va_arg and references pinskia at gcc dot gnu dot org
2006-07-17  3:14 ` mmitchel at gcc dot gnu dot org
2006-08-27 23:12 ` pinskia at gcc dot gnu dot org
2006-08-27 23:23 ` pinskia at gcc dot gnu dot org
2006-08-30  4:33 ` [Bug c++/28349] [4.0/4.1 " pinskia at gcc dot gnu dot org
2006-08-30  4:33 ` [Bug c++/28349] [4.0/4.1/4.2 " pinskia at gcc dot gnu dot org
2006-10-06  2:48 ` [Bug c++/28349] [4.0 " pinskia at gcc dot gnu dot org
2006-10-06  2:51 ` pinskia at gcc dot gnu dot org
2006-10-10  4:38 ` pinskia at gcc dot gnu dot org
2006-10-10  4:38 ` pinskia 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).