Bug 41368 - Erroneous aliasing rules violation messages are issued
Summary: Erroneous aliasing rules violation messages are issued
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.4.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-16 05:11 UTC by Yuri
Modified: 2009-09-16 08:02 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
testcase (363 bytes, text/plain)
2009-09-16 05:12 UTC, Yuri
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri 2009-09-16 05:11:14 UTC
When the attached testcase is compiled with gcc-4.4.1 there are two aliasing error messages issued, that appear to be wrong.
Comment 1 Yuri 2009-09-16 05:12:25 UTC
Created attachment 18593 [details]
testcase

command line: g++ -c -O5 -Wall pr.C
Comment 2 Yuri 2009-09-16 05:17:13 UTC
gcc-4.3.1 didn't issue such warnings.

I wasn't able to minimize the testcase more.
Somehow if eee instance of Zzzzz is removed and just Fffff::bbb() is called messages disappear. This is strange since code around lines in question is all the same in both cases.
Comment 3 Richard Biener 2009-09-16 08:02:00 UTC
The compiler warns for the store in

  D.1845_1 = (struct Fffff *) &eee.llll[0];
  D.1854_8 ={v} &0B->D.1740.rrrr[0];
  D.1845_1->ppp1 = D.1854_8;

because that stores to eee.llll (type char) via a pointer to type Fffff which
is invalid.
Comment 4 yuri@rawbw.com 2009-09-16 09:55:08 UTC
Subject: Re:  Erroneous aliasing rules violation messages are
 issued

rguenth at gcc dot gnu dot org wrote:
> ------- Comment #3 from rguenth at gcc dot gnu dot org  2009-09-16 08:02 -------
> The compiler warns for the store in
>
>   D.1845_1 = (struct Fffff *) &eee.llll[0];
>   D.1854_8 ={v} &0B->D.1740.rrrr[0];
>   D.1845_1->ppp1 = D.1854_8;
>
> because that stores to eee.llll (type char) via a pointer to type Fffff which
> is invalid.
>
>   


If this is the case, I agree with the warning, but why is it placed in 
function 'bbb', and not in 'ggg'? 'ggg' is the one that converts from 
unsigned char to Fffff.
I believe this is a bug that message is misplaced. This makes message 
misleading and confusing.
Message line should be fixed, and also it should be one message, not two.

This case should be reopened.

Thank you,
Yuri