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

            Bug ID: 92419
           Summary: const variable aliases lead to folding non-const
                    initializers
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

int var = 3;
extern const int const_var __attribute__((alias("var")));

void bar()
{
  var = 5;
}
int foo()
{
  int tem = const_var;
  bar ();
  return const_var;
}
int main()
{
  if (foo() != 5)
    __builtin_abort ();
  return 0;
}

Reply via email to