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

--- Comment #4 from Andreas K. Huettel <dilfridge at gentoo dot org> ---
Here's what cvise came up with as minimal test case.

1) compile command:
alpha-unknown-linux-gnu-gcc -c -fno-strict-overflow -Wsign-compare -mieee
-DNDEBUG     -mieee -pipe -O2 -mcpu=ev4 -fwrapv -std=c11 \
   -Wextra -Wno-unused-parameter -Wno-missing-field-initializers
-Wstrict-prototypes -Werror=implicit-function-declaration \
   -fvisibility=hidden -fPIC -DPy_BUILD_CORE  -o test $1

2) interestingness test:
/home/huettel/alpha-bug/compile.sh dtoa.i 2>&1 | grep 'Error: duplicate
!tlsgd!'

3) output:
======================
struct _ts {
  struct _dtoa_state *interp
};
struct Bigint {
  int k
} *_Py_dg_strtod_bs;
struct _dtoa_state {
  struct Bigint p5s;
  struct Bigint *freelist[]
};
extern _Thread_local struct _ts _Py_tss_tstate;
typedef struct Bigint Bigint;
int pow5mult_k;
long _Py_dg_strtod_ndigits;
void PyMem_Free();
void Bfree(Bigint *v) {
  if (v)
    if (v->k)
      PyMem_Free();
    else {
      struct _dtoa_state *interp = _Py_tss_tstate.interp;
      interp->freelist[v->k] = v;
    }
}
static Bigint *pow5mult(Bigint *b) {
  for (;;) {
    if (pow5mult_k & 1) {
      Bfree(b);
      if (b == 0)
        return 0;
    }
    if (!(pow5mult_k >>= 1))
      break;
  }
}
void _Py_dg_strtod() {
  if (_Py_dg_strtod_ndigits)
    pow5mult(_Py_dg_strtod_bs);
}
======================

4) double-check:
huettel@crossdev ~/alpha-bug $ ./compile.sh dtoa.i
dtoa.i:3:1: warning: no semicolon at end of struct or union
    3 | };
      | ^
dtoa.i:6:1: warning: no semicolon at end of struct or union
    6 | } *_Py_dg_strtod_bs;
      | ^
dtoa.i:10:1: warning: no semicolon at end of struct or union
   10 | };
      | ^
dtoa.i:15:1: warning: function declaration isn’t a prototype
[-Wstrict-prototypes]
   15 | void PyMem_Free();
      | ^~~~
dtoa.i:36:6: warning: function declaration isn’t a prototype
[-Wstrict-prototypes]
   36 | void _Py_dg_strtod() {
      |      ^~~~~~~~~~~~~
{standard input}: Assembler messages:
{standard input}:140: Error: duplicate !tlsgd!6

Reply via email to