public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: new offset outside bounds of constant string warning
@ 2009-04-28 13:45 Ben Elliston
  2009-04-28 15:08 ` H.J. Lu
  0 siblings, 1 reply; 7+ messages in thread
From: Ben Elliston @ 2009-04-28 13:45 UTC (permalink / raw)
  To: gcc; +Cc: iant, Manuel López-Ibáñez

On Manuel's recommendation, I have backed out revision 145102 for the
time being.  If someone wishes to have another go at it, the code is in
svn.

Cheers, Ben

--
Ben Elliston <bje@au.ibm.com>
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: new offset outside bounds of constant string warning
  2009-04-28 13:45 new offset outside bounds of constant string warning Ben Elliston
@ 2009-04-28 15:08 ` H.J. Lu
  2009-04-28 15:53   ` Manuel López-Ibáñez
  0 siblings, 1 reply; 7+ messages in thread
From: H.J. Lu @ 2009-04-28 15:08 UTC (permalink / raw)
  To: Ben Elliston; +Cc: gcc, iant, Manuel López-Ibáñez

2009/4/27 Ben Elliston <bje@au1.ibm.com>:
> On Manuel's recommendation, I have backed out revision 145102 for the
> time being.  If someone wishes to have another go at it, the code is in
> svn.
>
> Cheers, Ben

You should use "patch -E" apply any patches. I checked in revision 14689
 to remove the empty g++.dg/warn/pr35652.C and gcc.dg/pr35652.c.

-- 
H.J.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: new offset outside bounds of constant string warning
  2009-04-28 15:08 ` H.J. Lu
@ 2009-04-28 15:53   ` Manuel López-Ibáñez
  0 siblings, 0 replies; 7+ messages in thread
From: Manuel López-Ibáñez @ 2009-04-28 15:53 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Ben Elliston, gcc, iant

2009/4/28 H.J. Lu <hjl.tools@gmail.com>:
> 2009/4/27 Ben Elliston <bje@au1.ibm.com>:
>> On Manuel's recommendation, I have backed out revision 145102 for the
>> time being.  If someone wishes to have another go at it, the code is in
>> svn.
>>
>> Cheers, Ben
>
> You should use "patch -E" apply any patches. I checked in revision 14689
>  to remove the empty g++.dg/warn/pr35652.C and gcc.dg/pr35652.c.

The tests could stay as XFAILED. Perhaps is too late...

Cheers,

Manuel.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: new offset outside bounds of constant string warning
  2009-04-23 15:54 ` Manuel López-Ibáñez
@ 2009-04-23 23:58   ` Ian Lance Taylor
  0 siblings, 0 replies; 7+ messages in thread
From: Ian Lance Taylor @ 2009-04-23 23:58 UTC (permalink / raw)
  To: Manuel López-Ibáñez; +Cc: Ben Elliston, H.J. Lu, gcc

Manuel López-Ibáñez <lopezibanez@gmail.com> writes:

> I authored the patch, HJ just committed it. I cannot think any trivial
> way to fix this and I don't have much time to investigate. The PR is
> already reopened, so I think the patch should be reverted. Probably we
> warn too early now but the above testcase seems specially difficult to
> handle.

We may be able to handle it in a manner similar to skip_evaluation in
the C++ frontend.  When we see a conditional whose test evaluates to a
constant, then while processing the false branch we can note that the
code will never be executed, and suppress immediate warnings, and set
TREE_NO_WARNING to suppress future warnings.

Ian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: new offset outside bounds of constant string warning
  2009-04-23  8:17 Ben Elliston
  2009-04-23 14:38 ` Jakub Jelinek
@ 2009-04-23 15:54 ` Manuel López-Ibáñez
  2009-04-23 23:58   ` Ian Lance Taylor
  1 sibling, 1 reply; 7+ messages in thread
From: Manuel López-Ibáñez @ 2009-04-23 15:54 UTC (permalink / raw)
  To: Ben Elliston; +Cc: H.J. Lu, gcc

2009/4/23 Ben Elliston <bje@au1.ibm.com>:
> 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?
>

I authored the patch, HJ just committed it. I cannot think any trivial
way to fix this and I don't have much time to investigate. The PR is
already reopened, so I think the patch should be reverted. Probably we
warn too early now but the above testcase seems specially difficult to
handle.

With the revert, it would useful to add one of the failing testcases
to the testsuite, to avoid repeating this situation.

Cheers,

Manuel.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: new offset outside bounds of constant string warning
  2009-04-23  8:17 Ben Elliston
@ 2009-04-23 14:38 ` Jakub Jelinek
  2009-04-23 15:54 ` Manuel López-Ibáñez
  1 sibling, 0 replies; 7+ messages in thread
From: Jakub Jelinek @ 2009-04-23 14:38 UTC (permalink / raw)
  To: Ben Elliston; +Cc: H.J. Lu, gcc

On Thu, Apr 23, 2009 at 03:50:12PM +1000, Ben Elliston wrote:
> 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

It was actually Manuel, H.J. just committed the patch.
It has been reverted on the 4.4 branch already, and unless something is done
on the trunk I'd think it should be reverted on the trunk as well.

	Jakub

^ permalink raw reply	[flat|nested] 7+ messages in thread

* new offset outside bounds of constant string warning
@ 2009-04-23  8:17 Ben Elliston
  2009-04-23 14:38 ` Jakub Jelinek
  2009-04-23 15:54 ` Manuel López-Ibáñez
  0 siblings, 2 replies; 7+ messages in thread
From: Ben Elliston @ 2009-04-23  8:17 UTC (permalink / raw)
  To: H.J. Lu; +Cc: gcc

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-04-28 14:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-28 13:45 new offset outside bounds of constant string warning Ben Elliston
2009-04-28 15:08 ` H.J. Lu
2009-04-28 15:53   ` Manuel López-Ibáñez
  -- strict thread matches above, loose matches on Subject: below --
2009-04-23  8:17 Ben Elliston
2009-04-23 14:38 ` Jakub Jelinek
2009-04-23 15:54 ` Manuel López-Ibáñez
2009-04-23 23:58   ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).