public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/20534] New: Erroneous #include of <cassert>
@ 2005-03-18 16:13 sacolcor at provide dot net
  2005-03-18 16:54 ` [Bug libstdc++/20534] " pinskia at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: sacolcor at provide dot net @ 2005-03-18 16:13 UTC (permalink / raw)
  To: gcc-bugs

gcc/libstdc++-v3/include/debug/debug.h:272 reads:

#include <cassert> // TBD: temporary

Is this "temporary" include still needed?  It causes most uses of STL to pull in
the assert header, which means that programs can (and have) failed to compile on
versions of the compiler without this bug.

-- 
           Summary: Erroneous #include of <cassert>
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sacolcor at provide dot net
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug libstdc++/20534] Erroneous #include of <cassert>
  2005-03-18 16:13 [Bug libstdc++/20534] New: Erroneous #include of <cassert> sacolcor at provide dot net
@ 2005-03-18 16:54 ` pinskia at gcc dot gnu dot org
  2005-03-18 20:57 ` sacolcor at provide dot net
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-18 16:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-03-18 16:54 -------
Hmm, I know that the only header which is allowed to included twice is cassert/assert.h and change the 
behavior.  Also I know standard headers are allowed to bring in other standard headers.


So I don't know if this is a bug in libstdc++ or your code.

Could you give an example of where this fails?

-- 


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


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

* [Bug libstdc++/20534] Erroneous #include of <cassert>
  2005-03-18 16:13 [Bug libstdc++/20534] New: Erroneous #include of <cassert> sacolcor at provide dot net
  2005-03-18 16:54 ` [Bug libstdc++/20534] " pinskia at gcc dot gnu dot org
@ 2005-03-18 20:57 ` sacolcor at provide dot net
  2005-03-26 18:34 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: sacolcor at provide dot net @ 2005-03-18 20:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From sacolcor at provide dot net  2005-03-18 20:57 -------
I'm working on it, but it may take me a where to track it down to a minimal case.

You're correct in that this is legal behavior for a conforming compiler; the
actual "core" problem is that because gcc (and most other compilers) #includes
some standard headers in others, it's possible to write code that is invalid
(because it does not #include all of the necessary headers) but have it still
compile without a diagnostic.  Thus, it breaks when moved to a compiler with a
different internal library header configuration.

In this case, the change was the debug header rework performed between v3.3.2
and v3.4.0.

It was the obvious "temporary" label on that line that led me to believe that it
was erroneous; if it needs to stay there, it probably shouldn't be tagged that
way (or should indicate what its intended lifetime is).

-- 


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


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

* [Bug libstdc++/20534] Erroneous #include of <cassert>
  2005-03-18 16:13 [Bug libstdc++/20534] New: Erroneous #include of <cassert> sacolcor at provide dot net
  2005-03-18 16:54 ` [Bug libstdc++/20534] " pinskia at gcc dot gnu dot org
  2005-03-18 20:57 ` sacolcor at provide dot net
@ 2005-03-26 18:34 ` pinskia at gcc dot gnu dot org
  2005-03-26 18:44 ` gdr at integrable-solutions dot net
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-26 18:34 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |WAITING


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


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

* [Bug libstdc++/20534] Erroneous #include of <cassert>
  2005-03-18 16:13 [Bug libstdc++/20534] New: Erroneous #include of <cassert> sacolcor at provide dot net
                   ` (2 preceding siblings ...)
  2005-03-26 18:34 ` pinskia at gcc dot gnu dot org
@ 2005-03-26 18:44 ` gdr at integrable-solutions dot net
  2005-04-01 14:27 ` pcarlini at suse dot de
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: gdr at integrable-solutions dot net @ 2005-03-26 18:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2005-03-26 18:44 -------
Subject: Re:  Erroneous #include of <cassert>

"pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| -- 
|            What    |Removed                     |Added
| ----------------------------------------------------------------------------
|                  CC|                            |pinskia at gcc dot gnu dot
|                    |                            |org
|              Status|UNCONFIRMED                 |WAITING

I think it is not OK to include <cassert> or <assert.h>.


-- Gaby


-- 


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


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

* [Bug libstdc++/20534] Erroneous #include of <cassert>
  2005-03-18 16:13 [Bug libstdc++/20534] New: Erroneous #include of <cassert> sacolcor at provide dot net
                   ` (3 preceding siblings ...)
  2005-03-26 18:44 ` gdr at integrable-solutions dot net
@ 2005-04-01 14:27 ` pcarlini at suse dot de
  2005-04-01 20:13 ` pcarlini at suse dot de
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pcarlini at suse dot de @ 2005-04-01 14:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2005-04-01 14:26 -------
> I think it is not OK to include <cassert> or <assert.h>.

I agree. Actually, probably we have already briefly discussed that (privately)
with Benjamin. Is there something wrong with just using if () abort() instead?!?
(in case we can wrap it in a tiny macro to avoid writing the complete conditional
every time)



-- 


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


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

* [Bug libstdc++/20534] Erroneous #include of <cassert>
  2005-03-18 16:13 [Bug libstdc++/20534] New: Erroneous #include of <cassert> sacolcor at provide dot net
                   ` (4 preceding siblings ...)
  2005-04-01 14:27 ` pcarlini at suse dot de
@ 2005-04-01 20:13 ` pcarlini at suse dot de
  2005-04-01 22:54 ` pcarlini at suse dot de
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pcarlini at suse dot de @ 2005-04-01 20:13 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pcarlini at suse dot de
                   |dot org                     |
             Status|WAITING                     |ASSIGNED


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


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

* [Bug libstdc++/20534] Erroneous #include of <cassert>
  2005-03-18 16:13 [Bug libstdc++/20534] New: Erroneous #include of <cassert> sacolcor at provide dot net
                   ` (5 preceding siblings ...)
  2005-04-01 20:13 ` pcarlini at suse dot de
@ 2005-04-01 22:54 ` pcarlini at suse dot de
  2005-04-01 23:02 ` pcarlini at suse dot de
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pcarlini at suse dot de @ 2005-04-01 22:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2005-04-01 22:54 -------
Humpf! A problem with the trivial fix using abort() is that doesn't emit 
diagnostic about the failure point. This is relevant for <string>, which
uses _GLIBCXX_DEBUG_ASSERT/PEDASSERT directly.

-- 


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


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

* [Bug libstdc++/20534] Erroneous #include of <cassert>
  2005-03-18 16:13 [Bug libstdc++/20534] New: Erroneous #include of <cassert> sacolcor at provide dot net
                   ` (6 preceding siblings ...)
  2005-04-01 22:54 ` pcarlini at suse dot de
@ 2005-04-01 23:02 ` pcarlini at suse dot de
  2005-05-27 15:02 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pcarlini at suse dot de @ 2005-04-01 23:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2005-04-01 23:02 -------
...and also elsewhere (there are more uses besides <string>).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|pcarlini at suse dot de     |unassigned at gcc dot gnu
                   |                            |dot org
             Status|ASSIGNED                    |NEW


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


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

* [Bug libstdc++/20534] Erroneous #include of <cassert>
  2005-03-18 16:13 [Bug libstdc++/20534] New: Erroneous #include of <cassert> sacolcor at provide dot net
                   ` (7 preceding siblings ...)
  2005-04-01 23:02 ` pcarlini at suse dot de
@ 2005-05-27 15:02 ` cvs-commit at gcc dot gnu dot org
  2005-07-05 16:29 ` pcarlini at suse dot de
  2005-08-26 21:11 ` cvs-commit at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-05-27 15:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-05-27 15:02 -------
Subject: Bug 20534

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	bkoz@gcc.gnu.org	2005-05-27 15:01:46

Modified files:
	libstdc++-v3   : ChangeLog 
	libstdc++-v3/include: Makefile.am Makefile.in 
	libstdc++-v3/include/debug: debug.h hash_map hash_set 
	                            safe_iterator.h safe_sequence.h 
	                            vector 
	libstdc++-v3/include/ext: hash_map hash_set 
Added files:
	libstdc++-v3/include/debug: functions.h macros.h 
	libstdc++-v3/testsuite/17_intro: no_assert_neg.cc 

Log message:
	2005-05-27  Benjamin Kosnik  <bkoz@redhat.com>
	
	PR libstdc++/20534
	* include/debug/debug.h: Forwarding header, that pulls in details
	only if in debug mode.
	* include/debug/macros.h: ...transfer all the internal macros here.
	* include/debug/functions.h: ...transfer all the functions here.
	* include/debug/safe_iterator.h: Add functions.h, macros.h includes.
	* include/debug/safe_sequence.h: Same.
	* include/debug/vector: Tweak.
	* include/Makefile.am (debug_headers): Add new includes.
	* include/Makefile.in: Regenerate.
	* testsuite/17_intro/no_assert_neg.cc: Add.
	
	* include/ext/hash_set: Add debug mode include.
	* include/ext/hash_map: Same.
	* include/debug/hash_map: Fix included files to match actual files.
	* include/debug/hash_set: Same.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.3017&r2=1.3018
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/Makefile.am.diff?cvsroot=gcc&r1=1.100&r2=1.101
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/Makefile.in.diff?cvsroot=gcc&r1=1.135&r2=1.136
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/debug/functions.h.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/debug/macros.h.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/debug/debug.h.diff?cvsroot=gcc&r1=1.4&r2=1.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/debug/hash_map.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/debug/hash_set.diff?cvsroot=gcc&r1=1.2&r2=1.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/debug/safe_iterator.h.diff?cvsroot=gcc&r1=1.5&r2=1.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/debug/safe_sequence.h.diff?cvsroot=gcc&r1=1.3&r2=1.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/debug/vector.diff?cvsroot=gcc&r1=1.4&r2=1.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/ext/hash_map.diff?cvsroot=gcc&r1=1.18&r2=1.19
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/ext/hash_set.diff?cvsroot=gcc&r1=1.20&r2=1.21
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/17_intro/no_assert_neg.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug libstdc++/20534] Erroneous #include of <cassert>
  2005-03-18 16:13 [Bug libstdc++/20534] New: Erroneous #include of <cassert> sacolcor at provide dot net
                   ` (8 preceding siblings ...)
  2005-05-27 15:02 ` cvs-commit at gcc dot gnu dot org
@ 2005-07-05 16:29 ` pcarlini at suse dot de
  2005-08-26 21:11 ` cvs-commit at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pcarlini at suse dot de @ 2005-07-05 16:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2005-07-05 16:29 -------
Not a regression, completely fixed for 4.1.0.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.1.0


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


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

* [Bug libstdc++/20534] Erroneous #include of <cassert>
  2005-03-18 16:13 [Bug libstdc++/20534] New: Erroneous #include of <cassert> sacolcor at provide dot net
                   ` (9 preceding siblings ...)
  2005-07-05 16:29 ` pcarlini at suse dot de
@ 2005-08-26 21:11 ` cvs-commit at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-08-26 21:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-08-26 21:11 -------
Subject: Bug 20534

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	bkoz@gcc.gnu.org	2005-08-26 21:10:59

Modified files:
	libstdc++-v3   : ChangeLog 
	libstdc++-v3/config: linker-map.gnu 
	libstdc++-v3/include/debug: debug.h macros.h 
	libstdc++-v3/src: debug.cc 

Log message:
	2005-08-26  Benjamin Kosnik  <bkoz@redhat.com>
	
	PR libstdc++/20534 (contd)
	* src/debug.cc (__gnu_debug): Remove __fancy_abort definition.
	Remove cstdio and cstdlib includes.
	* include/debug/debug.h: Define inline here. Remove
	_GLIBCXX_DEBUG_ABORT.
	* include/debug/macros.h: Remove __fancy_abort declaration,
	_GLIBXX_DEBUG_ABORT definition.
	* config/linker-map.gnu: Remove export.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.3081&r2=1.3082
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/config/linker-map.gnu.diff?cvsroot=gcc&r1=1.83&r2=1.84
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/debug/debug.h.diff?cvsroot=gcc&r1=1.7&r2=1.8
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/debug/macros.h.diff?cvsroot=gcc&r1=1.3&r2=1.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/src/debug.cc.diff?cvsroot=gcc&r1=1.13&r2=1.14



-- 


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


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

end of thread, other threads:[~2005-08-26 21:11 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-18 16:13 [Bug libstdc++/20534] New: Erroneous #include of <cassert> sacolcor at provide dot net
2005-03-18 16:54 ` [Bug libstdc++/20534] " pinskia at gcc dot gnu dot org
2005-03-18 20:57 ` sacolcor at provide dot net
2005-03-26 18:34 ` pinskia at gcc dot gnu dot org
2005-03-26 18:44 ` gdr at integrable-solutions dot net
2005-04-01 14:27 ` pcarlini at suse dot de
2005-04-01 20:13 ` pcarlini at suse dot de
2005-04-01 22:54 ` pcarlini at suse dot de
2005-04-01 23:02 ` pcarlini at suse dot de
2005-05-27 15:02 ` cvs-commit at gcc dot gnu dot org
2005-07-05 16:29 ` pcarlini at suse dot de
2005-08-26 21:11 ` cvs-commit 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).