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

            Bug ID: 125730
           Summary: [16/17 regression] cython miscompiled on sparc, hppa
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
  Target Milestone: ---

Created attachment 64703
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64703&action=edit
test.c

Originally reported downstream in Gentoo at https://bugs.gentoo.org/976797.

```
char *key;
char *value;
char **name_regex = &key;

__attribute__ ((noipa)) void
dict_get_item_ref (char ***result)
{
  *result = &value;
}

__attribute__ ((noinline)) static void
parse_keyword_dict (char ***argnames, char ***values, int num_posargs, int
num_kwargs)
{
  char ***first_kw_arg = argnames + num_posargs;
  char ***name = first_kw_arg;

  while (*name && num_kwargs > 0)
    {
      char **fetched_value;
      dict_get_item_ref (&fetched_value);
      values[name - argnames] = fetched_value;
      name++;
    }
}

int
main (void)
{
  char **fetched_values[] = { 0 };
  char **argnames[] = { name_regex, 0 };
  parse_keyword_dict (argnames, fetched_values, 0, 1);

  if (fetched_values[0] != &value)
    {
      __builtin_abort ();
    }

  return 0;
```

```
$ gcc-16 test.c -o test -O0 && ./test
$ gcc-16 test.c -o test -O1 && ./test
Aborted                    (core dumped) ./test
```

Reply via email to