This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/45410] New: constant not optimized / propagated


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]