public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/21392] Wrong code generated for array of enum with "mode" attribute
       [not found] <bug-21392-8722@http.gcc.gnu.org/bugzilla/>
@ 2006-02-16  2:26 ` jde at google dot com
  2006-02-16  2:51 ` [Bug middle-end/21392] [4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: jde at google dot com @ 2006-02-16  2:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jde at google dot com  2006-02-16 02:26 -------
I was able to reproduce this bug. Indeed the offset is bytewise but the load is
done with a movl ("movl foo+2, %eax") Below is the program used to reproduce,
the compiler and flags used, and the resultant output & assembly.

Cheers
-Jeff

[calliope]% cat main.c
#include <stdio.h>

typedef enum { false, true } bool __attribute__((mode (byte))); 

bool foo[16] = { 1, 0, 1, 0, 1, 0, 1, 0,
                 1, 0, 1, 0, 1, 0, 1, 0 } ;

long test (int i)
{
    return foo[i];
}

int main(int argc, char*argv[])
{
   printf ("foo[2] (should be 1): %d\n", test(2));
   printf ("foo[5] (should be 0): %d\n", test(5));
}

[calliope]% i686-piii-linux-gnu-gcc-4.0.1 -O6 main.c -o main ; ./main
foo[2] (should be 1): 0
foo[5] (should be 0): 16777216

[calliope]% cat main.s
        .file   "main.c"
.globl foo
        .data
        .type   foo, @object
        .size   foo, 16
foo:
        .long   1
        .long   0
        .long   1
        .long   0
        .long   1
        .long   0
        .long   1
        .long   0
        .long   1
        .long   0
        .long   1
        .long   0
        .long   1
        .long   0
        .long   1
        .long   0
        .text
        .p2align 4,,15
.globl test
        .type   test, @function
test:
        pushl   %ebp
        movl    %esp, %ebp
        movl    8(%ebp), %eax
        popl    %ebp
        movl    foo(%eax), %eax
        ret
        .size   test, .-test
        .section        .rodata.str1.1,"aMS",@progbits,1
.LC0:
        .string "foo[2] (should be 1): %d\n"
.LC1:
        .string "foo[5] (should be 0): %d\n"
        .text
        .p2align 4,,15
.globl main
        .type   main, @function
main:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $8, %esp
        movl    foo+2, %eax
        andl    $-16, %esp
        subl    $16, %esp
        movl    $.LC0, (%esp)
        movl    %eax, 4(%esp)
        call    printf
        movl    foo+5, %eax
        movl    $.LC1, 8(%ebp)
        movl    %eax, 12(%ebp)
        leave
        jmp     printf
        .size   main, .-main
        .ident  "GCC: (GNU) 4.0.1"
        .section        .note.GNU-stack,"",@progbits


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21392


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/21392] [4.0 Regression] Wrong code generated for array of enum with "mode" attribute
       [not found] <bug-21392-8722@http.gcc.gnu.org/bugzilla/>
  2006-02-16  2:26 ` [Bug middle-end/21392] Wrong code generated for array of enum with "mode" attribute jde at google dot com
@ 2006-02-16  2:51 ` pinskia at gcc dot gnu dot org
  2006-03-11  3:17 ` mmitchel at gcc dot gnu dot org
  2007-01-18  4:09 ` gdr at gcc dot gnu dot org
  3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-16  2:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-02-16 02:51 -------
Confirmed, only a 4.0.x regression.  It works on the mainline and in 4.1.0.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-code
      Known to fail|                            |4.0.3
      Known to work|                            |4.1.0
   Last reconfirmed|0000-00-00 00:00:00         |2006-02-16 02:51:46
               date|                            |
            Summary|Wrong code generated for    |[4.0 Regression] Wrong code
                   |array of enum with "mode"   |generated for array of enum
                   |attribute                   |with "mode" attribute
   Target Milestone|---                         |4.0.3


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21392


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/21392] [4.0 Regression] Wrong code generated for array of enum with "mode" attribute
       [not found] <bug-21392-8722@http.gcc.gnu.org/bugzilla/>
  2006-02-16  2:26 ` [Bug middle-end/21392] Wrong code generated for array of enum with "mode" attribute jde at google dot com
  2006-02-16  2:51 ` [Bug middle-end/21392] [4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2006-03-11  3:17 ` mmitchel at gcc dot gnu dot org
  2007-01-18  4:09 ` gdr at gcc dot gnu dot org
  3 siblings, 0 replies; 6+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-03-11  3:17 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.3                       |4.0.4


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21392


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/21392] [4.0 Regression] Wrong code generated for array of enum with "mode" attribute
       [not found] <bug-21392-8722@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2006-03-11  3:17 ` mmitchel at gcc dot gnu dot org
@ 2007-01-18  4:09 ` gdr at gcc dot gnu dot org
  3 siblings, 0 replies; 6+ messages in thread
From: gdr at gcc dot gnu dot org @ 2007-01-18  4:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from gdr at gcc dot gnu dot org  2007-01-18 04:09 -------
won't fix for GCC-4.0.x


-- 

gdr at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21392


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/21392] Wrong code generated for array of enum with "mode" attribute
  2005-05-04 21:33 [Bug c/21392] New: " pkoning at equallogic dot com
  2005-05-05  0:03 ` [Bug middle-end/21392] " pinskia at gcc dot gnu dot org
@ 2005-05-05  0:04 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-05  0:04 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  GCC build triplet|i386-unknown-netbsdelf1.6.2 |
   GCC host triplet|i386-unknown-netbsdelf1.6.2 |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21392


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/21392] Wrong code generated for array of enum with "mode" attribute
  2005-05-04 21:33 [Bug c/21392] New: " pkoning at equallogic dot com
@ 2005-05-05  0:03 ` pinskia at gcc dot gnu dot org
  2005-05-05  0:04 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-05  0:03 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |middle-end


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21392


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-01-18  4:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-21392-8722@http.gcc.gnu.org/bugzilla/>
2006-02-16  2:26 ` [Bug middle-end/21392] Wrong code generated for array of enum with "mode" attribute jde at google dot com
2006-02-16  2:51 ` [Bug middle-end/21392] [4.0 Regression] " pinskia at gcc dot gnu dot org
2006-03-11  3:17 ` mmitchel at gcc dot gnu dot org
2007-01-18  4:09 ` gdr at gcc dot gnu dot org
2005-05-04 21:33 [Bug c/21392] New: " pkoning at equallogic dot com
2005-05-05  0:03 ` [Bug middle-end/21392] " pinskia at gcc dot gnu dot org
2005-05-05  0:04 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).