public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "sami dot kantoluoto at embedtronics dot fi" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/21171] New: Generates wrong code (w/ optimization) when copying data from a table to a table in a structure Date: Sat, 23 Apr 2005 08:18:00 -0000 [thread overview] Message-ID: <20050423081814.21171.sami.kantoluoto@embedtronics.fi> (raw) Compiling the test code with optimizations enabled generates invalid code. Data gets read from the source table but gets not written to the destination. Test code: /* start of test.c */ /* compile: arm-elf-gcc -Os -c -o test.o test.c */ /* dump: arm-elf-objdump -D test.o | more */ typedef unsigned int u_int32_t; typedef unsigned char u_int8_t; #define AIC_VECTORS 32 typedef volatile struct AT91RM9200_AIC { u_int32_t SVR[AIC_VECTORS]; } AT91RM9200_AIC_t; typedef volatile struct AT91RM9200_regs { AT91RM9200_AIC_t AIC; } AT91RM9200_regs_t; #define CPUReg ((AT91RM9200_regs_t*)0xFFF00000) extern const u_int32_t __IntTable[AIC_VECTORS]; int main() { int c; AT91RM9200_AIC_t *aic = &CPUReg->AIC; for (c=0; c < AIC_VECTORS; c++) { aic->SVR[c] = __IntTable[c]; } return 0; } /* end of test.c */ objdump output: test.o: file format elf32-littlearm Disassembly of section .text: 00000000 <main>: 0: e59f2014 ldr r2, [pc, #20] ; 1c <.text+0x1c> 4: e59f3014 ldr r3, [pc, #20] ; 20 <.text+0x20> 8: e2822004 add r2, r2, #4 ; 0x4 c: e1520003 cmp r2, r3 10: 1affffff bne 4 <main+0x4> 14: e3a00000 mov r0, #0 ; 0x0 18: e12fff1e bx lr As you can see, there is no store (str) instruction at all. Code just goes through the __IntTable[] but does nothing useful. -- Summary: Generates wrong code (w/ optimization) when copying data from a table to a table in a structure Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: critical Priority: P1 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sami dot kantoluoto at embedtronics dot fi CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i386-unknown-netbsdelf2.0 GCC host triplet: i386-unknown-netbsdelf2.0 GCC target triplet: arm-unknown-elf http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21171
next reply other threads:[~2005-04-23 8:18 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2005-04-23 8:18 sami dot kantoluoto at embedtronics dot fi [this message] 2005-04-23 8:31 ` [Bug c/21171] " sami dot kantoluoto at embedtronics dot fi 2005-04-23 8:45 ` sami dot kantoluoto at embedtronics dot fi 2005-04-23 13:29 ` [Bug target/21171] " pinskia at gcc dot gnu dot org 2005-04-26 18:35 ` [Bug tree-optimization/21171] [4.0 Regression] " rearnsha at gcc dot gnu dot org 2005-04-26 19:51 ` [Bug tree-optimization/21171] [4.0/4.1 " pinskia at gcc dot gnu dot org 2005-04-26 22:18 ` [Bug tree-optimization/21171] [4.0/4.1 Regression] IV OPTS removes does not create a new VOPs for constant values pinskia at gcc dot gnu dot org 2005-04-27 11:33 ` rakdver at gcc dot gnu dot org 2005-04-27 14:28 ` cvs-commit at gcc dot gnu dot org 2005-05-26 22:15 ` mmitchel at gcc dot gnu dot org 2005-06-02 14:35 ` pinskia at gcc dot gnu dot org 2005-06-13 19:24 ` cvs-commit at gcc dot gnu dot org 2005-06-13 19:43 ` pinskia at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20050423081814.21171.sami.kantoluoto@embedtronics.fi \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).