public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/59138] New: possible packed struct miscompile
@ 2013-11-14 23:00 regehr at cs dot utah.edu
  2013-11-15  9:17 ` [Bug c/59138] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: regehr at cs dot utah.edu @ 2013-11-14 23:00 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59138
           Summary: possible packed struct miscompile
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: regehr at cs dot utah.edu

[regehr@imp test1]$ clang -O -Wall ./work17/reduce_D0DDXs/small.c ; ./a.out 
0
[regehr@imp test1]$ gcc -O2 -Wall ./work17/reduce_D0DDXs/small.c ; ./a.out
0
[regehr@imp test1]$ gcc -Os -Wall ./work17/reduce_D0DDXs/small.c ; ./a.out
1
[regehr@imp test1]$ cat ./work17/reduce_D0DDXs/small.c
int printf(const char *, ...);
#pragma pack(1)
struct S0 {
  int f0;
  int f1;
  int f2;
  short f3;
};
short a = 1;
struct S0 b = { 1 }, c, d, e;

struct S0 fn1() { return c; }

void fn2() {
  b = fn1();
  a = 0;
  d = e;
}

int main() {
  fn2();
  printf("%d\n", a);
  return 0;
}
[regehr@imp test1]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/mnt/local/randomtest/compiler-install/gcc-r204770-install/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /users/regehr/z/compiler-source/gcc/configure
--prefix=/users/regehr/z/compiler-install/gcc-r204770-install
--enable-languages=c,c++ --enable-multilib
Thread model: posix
gcc version 4.9.0 20131114 (experimental) (GCC)


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

end of thread, other threads:[~2013-11-27  9:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-14 23:00 [Bug c/59138] New: possible packed struct miscompile regehr at cs dot utah.edu
2013-11-15  9:17 ` [Bug c/59138] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
2013-11-16 18:33 ` mikpelinux at gmail dot com
2013-11-21 14:41 ` [Bug rtl-optimization/59138] " rguenth at gcc dot gnu.org
2013-11-21 16:27 ` ebotcazou at gcc dot gnu.org
2013-11-22 11:08 ` ebotcazou at gcc dot gnu.org
2013-11-22 18:30 ` ebotcazou at gcc dot gnu.org
2013-11-22 18:56 ` [Bug middle-end/59138] " ebotcazou at gcc dot gnu.org
2013-11-27  9:17 ` ebotcazou at gcc dot gnu.org
2013-11-27  9:19 ` ebotcazou at gcc dot gnu.org
2013-11-27  9:49 ` ebotcazou at gcc dot gnu.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).