This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
new offset outside bounds of constant string warning
- From: Ben Elliston <bje at au1 dot ibm dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 23 Apr 2009 15:50:12 +1000
- Subject: new offset outside bounds of constant string warning
Hi HJ
According to svn annotate, it was you who authored the new 'offset
outside bounds of constant string warning' warning in GCC (well, I think
so, anyway). The compiler now complains about some code in the C++
demangler:
/home/bje/source/gcc-trunk/libiberty/cplus-dem.c:2651: warning: offset â3â outside bounds of constant string
I tracked this down to the definition of strspn used on my Linux system:
# define strspn(s, accept) \
__extension__ \
({ char __a0, __a1, __a2; \
(__builtin_constant_p (accept) && __string2_1bptr_p (accept) \
? ((__builtin_constant_p (s) && __string2_1bptr_p (s)) \
? __builtin_strspn (s, accept) \
: ((__a0 = ((__const char *) (accept))[0], __a0 == '\0') \
? ((void) (s), 0) \
: ((__a1 = ((__const char *) (accept))[1], __a1 == '\0') \
? __strspn_c1 (s, __a0) \
: ((__a2 = ((__const char *) (accept))[2], __a2 == '\0') \
? __strspn_c2 (s, __a0, __a1) \
: (((__const char *) (accept))[3] == '\0' \
? __strspn_c3 (s, __a0, __a1, __a2) \
: __builtin_strspn (s, accept)))))) \
: __builtin_strspn (s, accept)); })
Is this something you can fix?
Thanks, Ben