This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/45410] New: constant not optimized / propagated
- From: "reza at parvan dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Aug 2010 05:13:13 -0000
- Subject: [Bug c/45410] New: constant not optimized / propagated
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
gcc -Wall -O3 -S test.c
doesn't seem to propagate constants correctly.
Notice that ss is declared static, therefor everything is known at compile
time.
Code:
#include <stdio.h>
struct s {int i;int j;};
struct s static ss={77,2};
int
main()
{
ss.j += 88;
printf("%d\n",sizeof(ss));
return ss.i+ss.j;
};
--
Summary: constant not optimized / propagated
Product: gcc
Version: 4.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: reza at parvan dot net
GCC host triplet: x86 Ubuntu Linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45410