https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77280

            Bug ID: 77280
           Summary: program using sizeof(array) fails after adding a
                    statement with sizeof(array)
           Product: gcc
           Version: lto
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jorg at bnl dot gov
  Target Milestone: ---

Created attachment 39467
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39467&action=edit
source

Bug appears in:
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.2)
gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3) (64 bit)
clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)

Bug is not in:
gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3) (32 bit) 
pgcc 15.7-0 (portland group)

The attached code works correctly when 1) the two lines 
 45       unsigned int lx = sizeof(t);
 46       printf("lx %d\n", lx);
are removed or 2) the line 
 44        int a=0;
is added.
How to run:
>gcc 4.c
>a.out bug
should print
#####  #    #  ####  
#      #    # #    # 
#####  #    # #      
#    # #    # #  ### 
#    # #    # #    # 
#####   ####   ####  
lx 162
(The program was taken from www.gowrikumar.com/c/index.php)

Reply via email to