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 ipa/79043] New: Wrong code with optimize(("-fno-strict-aliasing")) and always_inline


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

            Bug ID: 79043
           Summary: Wrong code with optimize(("-fno-strict-aliasing")) and
                    always_inline
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
  Target Milestone: ---

Following code does not respect -no-strict-aliasing:

$ cat ./gcc/testsuite/gcc.c-torture/execute/alias-2.c
int val;

int *ptr = &val;
float *ptr2 = &val;

static
__attribute__((always_inline, optimize ("-fno-strict-aliasing")))
typepun ()
{
  *ptr2=0;
}

main()
{
  *ptr=1;
  typepun ();
  if (*ptr)
    __builtin_abort ();
}

$ gcc -O2 ./gcc/testsuite/gcc.c-torture/execute/alias-2.c && ./a.out
Aborted (core dumped)

Discussed in: https://gcc.gnu.org/ml/gcc/2017-01/msg00059.html

I'm testing patch for that.

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