This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/28289] New: composite_types called to do two different things
- From: "amylaar at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Jul 2006 17:59:59 -0000
- Subject: [Bug c/28289] New: composite_types called to do two different things
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
composite_types is called in c-decl.c to merge function declarations, but in
c-typeck.c to merge the types of two arms of a COND_EXPR. The former should
result in a union of traits of the inputs, which composite_types computes, but
the latter should give the intersection of traits unless the C standard
says otherwise.
In particular, when TREE_READONLY is set for a function type, that means that
this function has no side effect, i.e. it is pure. When a cond expression
yields a function type, it is pure only if both functions are pure.
When a call is made through a COND_EXPR which is improperly marked as yielding
a pure function pointer, and the result is ignored, the actual function call
is not emitted.
Likewise, when we merge the type of a function with a noreturn attribute
with the type of a function without that attribute, merging the types for
a COND_EXPR should yield a function type without this attribute.
--
Summary: composite_types called to do two different things
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: amylaar at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28289