public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/14173] New: cvs20040211: -fpack-struct crashes on hello_world.cpp
@ 2004-02-17 11:16 thome at lix dot polytechnique dot fr
  2004-02-17 16:08 ` [Bug libstdc++/14173] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: thome at lix dot polytechnique dot fr @ 2004-02-17 11:16 UTC (permalink / raw)
  To: gcc-bugs

g++ -fpack-struct hello.cpp ices within libstdc++ when compiling:

#include <iostream>
int main()
{
        std::cout << "Hello, world\n";
        return 0;
}

localhost : ~ $ g++ -c -fpack-struct hello.cpp
In file included from
/localdisk/thome/Packages/gcc-3.4-20040211/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/ios:49,
                 from
/localdisk/thome/Packages/gcc-3.4-20040211/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/ostream:45,
                 from
/localdisk/thome/Packages/gcc-3.4-20040211/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/iostream:45,
                 from hello.cpp:1:
/localdisk/thome/Packages/gcc-3.4-20040211/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/bits/ios_base.h:
In member function `std::_Ios_Fmtflags std::ios_base::setf(std::_Ios_Fmtflags)':
/localdisk/thome/Packages/gcc-3.4-20040211/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/bits/ios_base.h:535:
error: cannot bind packed field
`((std::ios_base*)this)->std::ios_base::_M_flags' to `std::_Ios_Fmtflags&'
/localdisk/thome/Packages/gcc-3.4-20040211/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/bits/ios_base.h:
In member function `std::_Ios_Fmtflags std::ios_base::setf(std::_Ios_Fmtflags,
std::_Ios_Fmtflags)':
/localdisk/thome/Packages/gcc-3.4-20040211/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/bits/ios_base.h:552:
error: cannot bind packed field
`((std::ios_base*)this)->std::ios_base::_M_flags' to `std::_Ios_Fmtflags&'
/localdisk/thome/Packages/gcc-3.4-20040211/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/bits/ios_base.h:553:
error: cannot bind packed field
`((std::ios_base*)this)->std::ios_base::_M_flags' to `std::_Ios_Fmtflags&'
/localdisk/thome/Packages/gcc-3.4-20040211/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/bits/ios_base.h:
In member function `void std::ios_base::unsetf(std::_Ios_Fmtflags)':
/localdisk/thome/Packages/gcc-3.4-20040211/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/bits/ios_base.h:564:
error: cannot bind packed field
`((std::ios_base*)this)->std::ios_base::_M_flags' to `std::_Ios_Fmtflags&'
g++: Internal error: Segmentation fault (program cc1plus)
Please submit a full bug report.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

-- 
           Summary: cvs20040211: -fpack-struct crashes on hello_world.cpp
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: thome at lix dot polytechnique dot fr
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug libstdc++/14173] [3.4/3.5 Regression] cvs20040211: -fpack-struct crashes on hello_world.cpp
  2004-02-17 11:16 [Bug libstdc++/14173] New: cvs20040211: -fpack-struct crashes on hello_world.cpp thome at lix dot polytechnique dot fr
@ 2004-02-17 16:08 ` pinskia at gcc dot gnu dot org
  2004-02-19  3:17 ` [Bug c++/14173] [3.4/3.5 Regression] " reichelt at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-17 16:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-02-17 16:08 -------
Confirmed.  The problem is that the seg fault is caused by a stack overflow due to infinite recursively.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |error-recovery, ice-on-
                   |                            |invalid-code
      Known to fail|                            |3.4.0 3.5.0
      Known to work|                            |3.3.1
   Last reconfirmed|0000-00-00 00:00:00         |2004-02-17 16:08:25
               date|                            |
            Summary|cvs20040211: -fpack-struct  |[3.4/3.5 Regression]
                   |crashes on hello_world.cpp  |cvs20040211: -fpack-struct
                   |                            |crashes on hello_world.cpp
   Target Milestone|---                         |3.4.0


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


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

* [Bug c++/14173] [3.4/3.5 Regression] -fpack-struct crashes on hello_world.cpp
  2004-02-17 11:16 [Bug libstdc++/14173] New: cvs20040211: -fpack-struct crashes on hello_world.cpp thome at lix dot polytechnique dot fr
  2004-02-17 16:08 ` [Bug libstdc++/14173] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-02-19  3:17 ` reichelt at gcc dot gnu dot org
  2004-02-20  2:41 ` giovannibajo at libero dot it
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-02-19  3:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2004-02-19 03:17 -------
Here's a redux for the ICE:

=============================================
struct A;

void foo(const A&);

struct A
{
    A(const A&);
};

struct B
{
    A a;
    A bar() { return a; }
};
=============================================

If the ICE is fixed one should probably revisit the errors in libstdc++.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org
           Severity|minor                       |critical
          Component|libstdc++                   |c++
           Keywords|error-recovery, ice-on-     |ice-on-valid-code, monitored
                   |invalid-code                |
      Known to work|3.3.1                       |3.3.3
            Summary|[3.4/3.5 Regression]        |[3.4/3.5 Regression] -fpack-
                   |cvs20040211: -fpack-struct  |struct crashes on
                   |crashes on hello_world.cpp  |hello_world.cpp


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


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

* [Bug c++/14173] [3.4/3.5 Regression] -fpack-struct crashes on hello_world.cpp
  2004-02-17 11:16 [Bug libstdc++/14173] New: cvs20040211: -fpack-struct crashes on hello_world.cpp thome at lix dot polytechnique dot fr
  2004-02-17 16:08 ` [Bug libstdc++/14173] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
  2004-02-19  3:17 ` [Bug c++/14173] [3.4/3.5 Regression] " reichelt at gcc dot gnu dot org
@ 2004-02-20  2:41 ` giovannibajo at libero dot it
  2004-02-20  7:10 ` mmitchel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: giovannibajo at libero dot it @ 2004-02-20  2:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-02-20 02:41 -------
The segfault looks like a memory corruption problem (or my GDB is nuts), so 
I'll leave it to someone else.

-fpack-struct is not compatible with libstdc++-v3. For once, you should have 
compiled the library itself with -fpack-struct, otherwise you are going to get 
segfaults at runtime due to different object layout. 

A good solution could be to make -fpack-struct affects only user-defined 
structures. This could be a check for structs defined in system headers or in 
namespace std (which is reserved anyway). I will submit a patch to change the 
behaviour of -fpack-struct once the segfault is solved.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |giovannibajo at libero dot
                   |                            |it


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


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

* [Bug c++/14173] [3.4/3.5 Regression] -fpack-struct crashes on hello_world.cpp
  2004-02-17 11:16 [Bug libstdc++/14173] New: cvs20040211: -fpack-struct crashes on hello_world.cpp thome at lix dot polytechnique dot fr
                   ` (2 preceding siblings ...)
  2004-02-20  2:41 ` giovannibajo at libero dot it
@ 2004-02-20  7:10 ` mmitchel at gcc dot gnu dot org
  2004-02-20  8:57 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-02-20  7:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-02-20 07:10 -------
IMO, the right fix for this PR is to remove -fpack-struct.  It's an option
likely to burn almost all users due to the fact that the C/C++ standard
libraries are never going to be built in that mode on most systems.  

Structure-packing should be done on a per-type basis.

On the other hand, there's an easy fix.  I'll check that in when testing completes.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/14173] [3.4/3.5 Regression] -fpack-struct crashes on hello_world.cpp
  2004-02-17 11:16 [Bug libstdc++/14173] New: cvs20040211: -fpack-struct crashes on hello_world.cpp thome at lix dot polytechnique dot fr
                   ` (3 preceding siblings ...)
  2004-02-20  7:10 ` mmitchel at gcc dot gnu dot org
@ 2004-02-20  8:57 ` cvs-commit at gcc dot gnu dot org
  2004-02-20  9:03 ` cvs-commit at gcc dot gnu dot org
  2004-02-20  9:04 ` mmitchel at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-02-20  8:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-02-20 08:57 -------
Subject: Bug 14173

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-02-20 08:57:33

Modified files:
	gcc/cp         : ChangeLog decl.c name-lookup.c pt.c semantics.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/g++.dg/other: error8.C 
Added files:
	gcc/testsuite/g++.dg/ext: packed5.C 
	gcc/testsuite/g++.dg/warn: Wunused-5.C 

Log message:
	PR c++/14199
	* pt.c (tsubst_copy): Call mark_used for a PARM_DECL.
	
	PR c++/14173
	* semantics.c (begin_class_definition): Set TYPE_PACKED correctly
	for all type variants.
	
	PR c++/14173
	* g++.dg/ext/packed5.C: New test.
	
	PR c++/14199
	* g++.dg/warn/Wunused-5.C: New test.
	
	PR c++/13927
	* decl.c (duplicate_decls): Return error_mark_node for invalid
	redeclarations.
	* name-lookup.c (push_namespace): Ignore the return value from
	pushdecl.
	* pt.c (push_template_decl_real): Robustify.
	
	PR c++/13927
	* g++.dg/other/error8.C: Remove XFAIL markers.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3962&r2=1.3963
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1187&r2=1.1188
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.c.diff?cvsroot=gcc&r1=1.39&r2=1.40
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.830&r2=1.831
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&r1=1.388&r2=1.389
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3523&r2=1.3524
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/packed5.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/other/error8.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/warn/Wunused-5.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug c++/14173] [3.4/3.5 Regression] -fpack-struct crashes on hello_world.cpp
  2004-02-17 11:16 [Bug libstdc++/14173] New: cvs20040211: -fpack-struct crashes on hello_world.cpp thome at lix dot polytechnique dot fr
                   ` (4 preceding siblings ...)
  2004-02-20  8:57 ` cvs-commit at gcc dot gnu dot org
@ 2004-02-20  9:03 ` cvs-commit at gcc dot gnu dot org
  2004-02-20  9:04 ` mmitchel at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-02-20  9:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-02-20 09:03 -------
Subject: Bug 14173

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	mmitchel@gcc.gnu.org	2004-02-20 09:03:34

Modified files:
	gcc/cp         : ChangeLog pt.c semantics.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/ext: packed5.C 
	gcc/testsuite/g++.dg/warn: Wunused-5.C 

Log message:
	PR c++/14199
	* pt.c (tsubst_copy): Call mark_used for a PARM_DECL.
	
	PR c++/14173
	* semantics.c (begin_class_definition): Set TYPE_PACKED correctly
	for all type variants.
	
	PR c++/14173
	* g++.dg/ext/packed5.C: New test.
	
	PR c++/14199
	* g++.dg/warn/Wunused-5.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.57&r2=1.3892.2.58
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.816.2.11&r2=1.816.2.12
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.381.4.7&r2=1.381.4.8
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.95&r2=1.3389.2.96
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/packed5.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/warn/Wunused-5.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1



-- 


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


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

* [Bug c++/14173] [3.4/3.5 Regression] -fpack-struct crashes on hello_world.cpp
  2004-02-17 11:16 [Bug libstdc++/14173] New: cvs20040211: -fpack-struct crashes on hello_world.cpp thome at lix dot polytechnique dot fr
                   ` (5 preceding siblings ...)
  2004-02-20  9:03 ` cvs-commit at gcc dot gnu dot org
@ 2004-02-20  9:04 ` mmitchel at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-02-20  9:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-02-20 09:04 -------
Fixed in GCC 3.4.

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


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


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

end of thread, other threads:[~2004-02-20  9:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-17 11:16 [Bug libstdc++/14173] New: cvs20040211: -fpack-struct crashes on hello_world.cpp thome at lix dot polytechnique dot fr
2004-02-17 16:08 ` [Bug libstdc++/14173] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
2004-02-19  3:17 ` [Bug c++/14173] [3.4/3.5 Regression] " reichelt at gcc dot gnu dot org
2004-02-20  2:41 ` giovannibajo at libero dot it
2004-02-20  7:10 ` mmitchel at gcc dot gnu dot org
2004-02-20  8:57 ` cvs-commit at gcc dot gnu dot org
2004-02-20  9:03 ` cvs-commit at gcc dot gnu dot org
2004-02-20  9:04 ` mmitchel 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).