This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/22371] C front-end produces mis-match types in MODIFY_EXPR
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Aug 2007 13:12:01 -0000
- Subject: [Bug c/22371] C front-end produces mis-match types in MODIFY_EXPR
- References: <bug-22371-6528@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #8 from joseph at codesourcery dot com 2007-08-22 13:12 -------
Subject: Re: C front-end produces mis-match types in MODIFY_EXPR
On Wed, 22 Aug 2007, rguenth at gcc dot gnu dot org wrote:
> Is the following valid?
>
> typedef int IA[];
> typedef int A5[5];
> typedef int A10[10];
>
> A5 array5;
>
> A10 *ap;
> void
> f (void)
> {
> int ap;
> {
> extern IA *ap;
>
> ap = &array5;
> }
> }
The conclusion was it should be valid at least at compile time.
> The real problem is that the frontend creates a conversion to (int[] *) rather
> than (A5 *) which is the type of ap at gimplification time. The patch
> doesn't address this, but merely forces the conversion to (int[] *) which is
> there also without the patch.
I think the C gimplifier should accept such assignments between compatible
types (not other pairs of types that can be assigned in C, just compatible
types) and generate whatever conversions are needed for valid GIMPLE at
that point.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22371