public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/53532] New: function call ignored when called with argument of incompatible, undefined structure
@ 2012-05-30 16:52 machata at post dot cz
2012-05-30 19:10 ` [Bug c/53532] " joseph at codesourcery dot com
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: machata at post dot cz @ 2012-05-30 16:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53532
Bug #: 53532
Summary: function call ignored when called with argument of
incompatible, undefined structure
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: machata@post.cz
The following code...
struct aaa {};
extern int xxx(struct aaa e);
int main() {
xxx((struct bbb) {});
return 0;
}
... compiles without warnings and the call to xxx is ignored:
# gcc -Wall -Wextra -c foo.c
# objdump -x foo.o
[...]
Disassembly of section .text:
0000000000000000 <main>:
0: 55 push %rbp
1: 48 89 e5 mov %rsp,%rbp
4: b8 00 00 00 00 mov $0x0,%eax
9: 5d pop %rbp
a: c3 retq
[...]
The code above seems invalid, and I think that gcc should reject it.
The definition of struct aaa is somehow important. When dropped, GCC realizes
things are wrong, and complains abundantly.
# LANG=C gcc -Wall -Wextra -x c /dev/stdin
extern int xxx(struct aaa e);
int main() {
xxx((struct bbb) {});
return 0;
}
/dev/stdin:1:23: warning: 'struct aaa' declared inside parameter list [enabled
by default]
/dev/stdin:1:23: warning: its scope is only this definition or declaration,
which is probably not what you want [enabled by default]
/dev/stdin: In function 'main':
/dev/stdin:3:15: error: type of formal parameter 1 is incomplete
It also complains about struct bbb being incomplete, which it didn't mind at
all while aaa was there.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/53532] function call ignored when called with argument of incompatible, undefined structure
2012-05-30 16:52 [Bug c/53532] New: function call ignored when called with argument of incompatible, undefined structure machata at post dot cz
@ 2012-05-30 19:10 ` joseph at codesourcery dot com
2012-05-31 12:10 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: joseph at codesourcery dot com @ 2012-05-30 19:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53532
--- Comment #1 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2012-05-30 19:08:18 UTC ---
This looks like another case of bug 51034.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/53532] function call ignored when called with argument of incompatible, undefined structure
2012-05-30 16:52 [Bug c/53532] New: function call ignored when called with argument of incompatible, undefined structure machata at post dot cz
2012-05-30 19:10 ` [Bug c/53532] " joseph at codesourcery dot com
@ 2012-05-31 12:10 ` jakub at gcc dot gnu.org
2012-06-12 21:16 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-05-31 12:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53532
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2012-05-31
AssignedTo|unassigned at gcc dot |jakub at gcc dot gnu.org
|gnu.org |
Ever Confirmed|0 |1
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-05-31 11:12:56 UTC ---
Created attachment 27530
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27530
gcc48-pr53532.patch
Untested fix. Not a regression though, at least not recent, already 3.2 is
silent on it.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/53532] function call ignored when called with argument of incompatible, undefined structure
2012-05-30 16:52 [Bug c/53532] New: function call ignored when called with argument of incompatible, undefined structure machata at post dot cz
2012-05-30 19:10 ` [Bug c/53532] " joseph at codesourcery dot com
2012-05-31 12:10 ` jakub at gcc dot gnu.org
@ 2012-06-12 21:16 ` jakub at gcc dot gnu.org
2013-02-19 20:38 ` LpSolit at netscape dot net
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-06-12 21:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53532
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-06-12 21:16:24 UTC ---
Author: jakub
Date: Tue Jun 12 21:16:20 2012
New Revision: 188483
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188483
Log:
PR c/53532
PR c/51034
PR c/53196
* c-decl.c (build_compound_literal): Call c_incomplete_type_error
if type isn't complete.
* gcc.dg/pr53532.c: New test.
* gcc.dg/c99-complit-2.c: Add two new dg-error directives,
adjust line numbers.
* gcc.dg/noncompile/950825-1.c: Expect incomplete type error message.
* gcc.dg/Wcxx-compat-8.c: Likewise.
* gcc.dg/pr51034.c: New test.
* gcc.dg/pr53196-1.c: New test.
* gcc.dg/pr53196-2.c: New test.
Added:
trunk/gcc/testsuite/gcc.dg/pr51034.c
trunk/gcc/testsuite/gcc.dg/pr53196-1.c
trunk/gcc/testsuite/gcc.dg/pr53196-2.c
trunk/gcc/testsuite/gcc.dg/pr53532.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/c-decl.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/Wcxx-compat-8.c
trunk/gcc/testsuite/gcc.dg/c99-complit-2.c
trunk/gcc/testsuite/gcc.dg/noncompile/950825-1.c
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/53532] function call ignored when called with argument of incompatible, undefined structure
2012-05-30 16:52 [Bug c/53532] New: function call ignored when called with argument of incompatible, undefined structure machata at post dot cz
` (2 preceding siblings ...)
2012-06-12 21:16 ` jakub at gcc dot gnu.org
@ 2013-02-19 20:38 ` LpSolit at netscape dot net
2013-10-17 20:24 ` mpolacek at gcc dot gnu.org
2013-10-17 20:24 ` mpolacek at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: LpSolit at netscape dot net @ 2013-02-19 20:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53532
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-06-12 21:16:24 UTC ---
Author: jakub
Date: Tue Jun 12 21:16:20 2012
New Revision: 188483
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188483
Log:
PR c/53532
PR c/51034
PR c/53196
* c-decl.c (build_compound_literal): Call c_incomplete_type_error
if type isn't complete.
* gcc.dg/pr53532.c: New test.
* gcc.dg/c99-complit-2.c: Add two new dg-error directives,
adjust line numbers.
* gcc.dg/noncompile/950825-1.c: Expect incomplete type error message.
* gcc.dg/Wcxx-compat-8.c: Likewise.
* gcc.dg/pr51034.c: New test.
* gcc.dg/pr53196-1.c: New test.
* gcc.dg/pr53196-2.c: New test.
Added:
trunk/gcc/testsuite/gcc.dg/pr51034.c
trunk/gcc/testsuite/gcc.dg/pr53196-1.c
trunk/gcc/testsuite/gcc.dg/pr53196-2.c
trunk/gcc/testsuite/gcc.dg/pr53532.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/c-decl.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/Wcxx-compat-8.c
trunk/gcc/testsuite/gcc.dg/c99-complit-2.c
trunk/gcc/testsuite/gcc.dg/noncompile/950825-1.c
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/53532] function call ignored when called with argument of incompatible, undefined structure
2012-05-30 16:52 [Bug c/53532] New: function call ignored when called with argument of incompatible, undefined structure machata at post dot cz
` (3 preceding siblings ...)
2013-02-19 20:38 ` LpSolit at netscape dot net
@ 2013-10-17 20:24 ` mpolacek at gcc dot gnu.org
2013-10-17 20:24 ` mpolacek at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-10-17 20:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53532
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
CC| |mpolacek at gcc dot gnu.org
Resolution|--- |FIXED
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/53532] function call ignored when called with argument of incompatible, undefined structure
2012-05-30 16:52 [Bug c/53532] New: function call ignored when called with argument of incompatible, undefined structure machata at post dot cz
` (4 preceding siblings ...)
2013-10-17 20:24 ` mpolacek at gcc dot gnu.org
@ 2013-10-17 20:24 ` mpolacek at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-10-17 20:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53532
Bug 53532 depends on bug 51034, which changed state.
Bug 51034 Summary: invalid typeof usage
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51034
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-10-17 20:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-30 16:52 [Bug c/53532] New: function call ignored when called with argument of incompatible, undefined structure machata at post dot cz
2012-05-30 19:10 ` [Bug c/53532] " joseph at codesourcery dot com
2012-05-31 12:10 ` jakub at gcc dot gnu.org
2012-06-12 21:16 ` jakub at gcc dot gnu.org
2013-02-19 20:38 ` LpSolit at netscape dot net
2013-10-17 20:24 ` mpolacek at gcc dot gnu.org
2013-10-17 20:24 ` mpolacek at gcc dot gnu.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).