public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/66946] New: Spurious uninitialized warning
@ 2015-07-20 16:25 wdijkstr at arm dot com
  2015-07-21 13:10 ` [Bug tree-optimization/66946] " wdijkstr at arm dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: wdijkstr at arm dot com @ 2015-07-20 16:25 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 66946
           Summary: Spurious uninitialized warning
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wdijkstr at arm dot com
  Target Milestone: ---

Created attachment 36016
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36016&action=edit
preprocessed iso-2022-cn-ext.c

Since recently (around May) GCC6 has started to emit spurious uninitialized
warnings. An example from building GLIBC (compiled attached pp file with -O2
-Wall -c out.i):

In file included from iso-2022-cn-ext.c:659:0:
../iconv/skeleton.c: In function 'gconv':
../iconv/loop.c:325:295: warning: '*((void *)&buf+1)' is used uninitialized in
this function [-Wuninitialized]
../iconv/loop.c:325:295: warning: 'buf' is used uninitialized in this function
[-Wuninitialized]
../iconv/loop.c:325:295: warning: '*((void *)&buf+1)' is used uninitialized in
this function [-Wuninitialized]
../iconv/loop.c:325:295: warning: 'buf' is used uninitialized in this function
[-Wuninitialized]
In file included from iso-2022-cn-ext.c:659:0:
../iconv/loop.c:435:295: warning: '*((void *)&buf+1)' is used uninitialized in
this function [-Wuninitialized]
../iconv/loop.c:435:295: warning: 'buf' is used uninitialized in this function
[-Wuninitialized]

I checked the control flow and it seems correct.
glibc/iconvdata/iso-2022-cn-ext.c calls one of ucs4_to_gb2312, ucs4_to_isoir165
and ucs4_to_cns11643l1 at lines 432-447 - buf is not written if
__UNKNOWN_10646_CHAR is returned. In that case however the if statement is
executed which does eventually set buf[0] and buf[1]. There is no warning if
inlining is disabled, so it is caused by the ucs4_* inline functions not always
setting buf.


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

* [Bug tree-optimization/66946] Spurious uninitialized warning
  2015-07-20 16:25 [Bug tree-optimization/66946] New: Spurious uninitialized warning wdijkstr at arm dot com
@ 2015-07-21 13:10 ` wdijkstr at arm dot com
  2015-07-21 13:28 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: wdijkstr at arm dot com @ 2015-07-21 13:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Wilco <wdijkstr at arm dot com> ---
Created attachment 36021
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36021&action=edit
minimal example

Minimal example which still reports the spurious warning.


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

* [Bug tree-optimization/66946] Spurious uninitialized warning
  2015-07-20 16:25 [Bug tree-optimization/66946] New: Spurious uninitialized warning wdijkstr at arm dot com
  2015-07-21 13:10 ` [Bug tree-optimization/66946] " wdijkstr at arm dot com
@ 2015-07-21 13:28 ` pinskia at gcc dot gnu.org
  2015-07-21 13:31 ` pinskia at gcc dot gnu.org
  2015-07-21 13:42 ` wdijkstr at arm dot com
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-07-21 13:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Comment on attachment 36021
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36021
minimal example

written == ((wchar_t) 0xfffd)

Will ever be true or is there some sign extending going on which causes this to
be false for the default case?


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

* [Bug tree-optimization/66946] Spurious uninitialized warning
  2015-07-20 16:25 [Bug tree-optimization/66946] New: Spurious uninitialized warning wdijkstr at arm dot com
  2015-07-21 13:10 ` [Bug tree-optimization/66946] " wdijkstr at arm dot com
  2015-07-21 13:28 ` pinskia at gcc dot gnu.org
@ 2015-07-21 13:31 ` pinskia at gcc dot gnu.org
  2015-07-21 13:42 ` wdijkstr at arm dot com
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-07-21 13:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Ok. This just looks like a missing jump threading.


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

* [Bug tree-optimization/66946] Spurious uninitialized warning
  2015-07-20 16:25 [Bug tree-optimization/66946] New: Spurious uninitialized warning wdijkstr at arm dot com
                   ` (2 preceding siblings ...)
  2015-07-21 13:31 ` pinskia at gcc dot gnu.org
@ 2015-07-21 13:42 ` wdijkstr at arm dot com
  3 siblings, 0 replies; 5+ messages in thread
From: wdijkstr at arm dot com @ 2015-07-21 13:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Wilco <wdijkstr at arm dot com> ---
(In reply to Andrew Pinski from comment #2)
> Comment on attachment 36021 [details]
> minimal example
> 
> written == ((wchar_t) 0xfffd)
> 
> Will ever be true or is there some sign extending going on which causes this
> to be false for the default case?

The issue seems related to signextension indeed. My GCC builds include this
patch: https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00005.html

When I disable this new phase the warning disappears, so it might be due to a
transformation it makes. The generated code is virtually identical, just
different register allocation.


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

end of thread, other threads:[~2015-07-21 13:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-20 16:25 [Bug tree-optimization/66946] New: Spurious uninitialized warning wdijkstr at arm dot com
2015-07-21 13:10 ` [Bug tree-optimization/66946] " wdijkstr at arm dot com
2015-07-21 13:28 ` pinskia at gcc dot gnu.org
2015-07-21 13:31 ` pinskia at gcc dot gnu.org
2015-07-21 13:42 ` wdijkstr at arm dot com

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).