public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/33975] New: [4.1/4.2/4.3 Regression] Incomplete types may be derefenced
@ 2007-11-01 17:58 andrew dot stubbs at st dot com
2007-11-02 13:59 ` [Bug c++/33975] " rguenth at gcc dot gnu dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: andrew dot stubbs at st dot com @ 2007-11-01 17:58 UTC (permalink / raw)
To: gcc-bugs
The following C++ program should not compile:
struct S;
int f(S s);
S *p;
int i = f(*p);
Here an incomplete type is dereferenced as it is passed as a function
argument.
This is forbidden by the C++ standard, clause 3, paragraph 4 (penultimate
bullet). And anyway, how could you compile it to anything sensible without
knowing how big the type is?
Other attempts to dereference incomplete types are diagnosed correctly.
This used to be diagnosed in GCC 4.1.1, but is missing in GCC 4.1.2 onwards.
--
Summary: [4.1/4.2/4.3 Regression] Incomplete types may be
derefenced
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: andrew dot stubbs at st dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33975
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/33975] [4.1/4.2/4.3 Regression] Incomplete types may be derefenced
2007-11-01 17:58 [Bug c++/33975] New: [4.1/4.2/4.3 Regression] Incomplete types may be derefenced andrew dot stubbs at st dot com
@ 2007-11-02 13:59 ` rguenth at gcc dot gnu dot org
2007-11-12 18:01 ` janis at gcc dot gnu dot org
2007-11-12 19:50 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-11-02 13:59 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2007-11-02 13:59 -------
Confirmed.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |accepts-invalid
Last reconfirmed|0000-00-00 00:00:00 |2007-11-02 13:59:28
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33975
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/33975] [4.1/4.2/4.3 Regression] Incomplete types may be derefenced
2007-11-01 17:58 [Bug c++/33975] New: [4.1/4.2/4.3 Regression] Incomplete types may be derefenced andrew dot stubbs at st dot com
2007-11-02 13:59 ` [Bug c++/33975] " rguenth at gcc dot gnu dot org
@ 2007-11-12 18:01 ` janis at gcc dot gnu dot org
2007-11-12 19:50 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: janis at gcc dot gnu dot org @ 2007-11-12 18:01 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 711 bytes --]
------- Comment #2 from janis at gcc dot gnu dot org 2007-11-12 18:01 -------
Mainline now reports an error for this code:
elm3b187% /opt/gcc-nightly/trunk/bin/g++ 33975.cc
33975.cc: In function int main():
33975.cc:8: error: invalid use of incomplete type struct S
33975.cc:1: error: forward declaration of struct S
33975.cc:8: error: initializing argument 1 of int f(S)
The patch that fixed this for mainline:
http://gcc.gnu.org/viewcvs?view=rev&rev=129968
r129968 | jakub | 2007-11-07 19:27:27 +0000 (Wed, 07 Nov 2007)
Here's the source file I used:
struct S;
int f(S s);
int
main ()
{
S *p;
int i = f(*p);
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33975
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/33975] [4.1/4.2/4.3 Regression] Incomplete types may be derefenced
2007-11-01 17:58 [Bug c++/33975] New: [4.1/4.2/4.3 Regression] Incomplete types may be derefenced andrew dot stubbs at st dot com
2007-11-02 13:59 ` [Bug c++/33975] " rguenth at gcc dot gnu dot org
2007-11-12 18:01 ` janis at gcc dot gnu dot org
@ 2007-11-12 19:50 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-11-12 19:50 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2007-11-12 19:50 -------
The issue here is an exact dup of bug 33501.
*** This bug has been marked as a duplicate of 33501 ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33975
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-11-12 19:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-01 17:58 [Bug c++/33975] New: [4.1/4.2/4.3 Regression] Incomplete types may be derefenced andrew dot stubbs at st dot com
2007-11-02 13:59 ` [Bug c++/33975] " rguenth at gcc dot gnu dot org
2007-11-12 18:01 ` janis at gcc dot gnu dot org
2007-11-12 19:50 ` 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).