This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/14661] [3.3? Regression] ?: operator result structure's member array can't be assigned to pointer
- From: "reichelt at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Mar 2004 02:54:50 -0000
- Subject: [Bug c/14661] [3.3? Regression] ?: operator result structure's member array can't be assigned to pointer
- References: <20040320011934.14661.dmj36@email.byu.edu>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From reichelt at gcc dot gnu dot org 2004-03-20 02:54 -------
The code used to compile with gcc 2.95.x - 3.0.x, but ICEd with 3.1 - 3.3.1.
Since gcc 3.3.2 the ICE is gone - the code is rejected.
But is the code really invalid?
The code does compile as C++ source or with the option "-std=c99".
It also compiles, if I replace the condition (source == FOREIGN)
with a constant.
Here's a shorter example that demonstrates the problem:
======================================
struct A
{
char str[1];
};
struct A a = { "" };
struct A b = { "" };
void foo (int i)
{
char *p = ( i ? a : b ).str;
}
======================================
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |reichelt at gcc dot gnu dot
| |org
Known to fail|3.3.1 |3.1 3.1.1 3.1.2 3.2 3.2.1
| |3.2.2 3.2.3 3.3 3.3.1
Known to work|3.4.0 3.5.0 3.0.4 3.2.3 |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14661