public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/99340] New: [10/11 Regression] -Werror=maybe-uninitialized warning with -fPIE, but not -fPIC
@ 2021-03-02 12:04 doko at debian dot org
  2021-03-02 12:10 ` [Bug c/99340] " marxin at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: doko at debian dot org @ 2021-03-02 12:04 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99340
           Summary: [10/11 Regression] -Werror=maybe-uninitialized warning
                    with -fPIE, but not -fPIC
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: doko at debian dot org
  Target Milestone: ---

seen building the gsequencer package.
the warning was not emitted with gcc-10 branch 20210110, but is emitted with
20210228, also emitted with trunk 20210220.

$ cat ags_midi_buffer_util.i
long ags_midi_buffer_util_seek_message_delta_time;
int ags_midi_buffer_util_seek_message_i;
int ags_midi_buffer_util_get_varlength() { return 0; }
char ags_midi_buffer_util_seek_message() {
  long current_delta_time;
  for (; ags_midi_buffer_util_seek_message_i;
       ags_midi_buffer_util_seek_message_i++) {
    ags_midi_buffer_util_get_varlength(&current_delta_time);
    ags_midi_buffer_util_seek_message_delta_time = current_delta_time;
  }
  return 0;
}

$ gcc -std=gnu99 -Wall -Werror=maybe-uninitialized -fstack-protector-strong
-fPIE -O1 -c ags_midi_buffer_util.i
ags_midi_buffer_util.i: In function 'ags_midi_buffer_util_seek_message':
ags_midi_buffer_util.i:5:8: error: 'current_delta_time' may be used
uninitialized in this function [-Werror=maybe-uninitialized]
    5 |   long current_delta_time;
      |        ^~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

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

* [Bug c/99340] [10/11 Regression] -Werror=maybe-uninitialized warning with -fPIE, but not -fPIC
  2021-03-02 12:04 [Bug c/99340] New: [10/11 Regression] -Werror=maybe-uninitialized warning with -fPIE, but not -fPIC doko at debian dot org
@ 2021-03-02 12:10 ` marxin at gcc dot gnu.org
  2021-03-02 12:36 ` [Bug c/99340] " rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-03-02 12:10 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org
   Last reconfirmed|                            |2021-03-02
             Status|UNCONFIRMED                 |WAITING
     Ever confirmed|0                           |1

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
I see the warning (with -fPIE) for all releases I have (4.8.0+).
But yes, -fPIC does not report the warning.

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

* [Bug c/99340] -Werror=maybe-uninitialized warning with -fPIE, but not -fPIC
  2021-03-02 12:04 [Bug c/99340] New: [10/11 Regression] -Werror=maybe-uninitialized warning with -fPIE, but not -fPIC doko at debian dot org
  2021-03-02 12:10 ` [Bug c/99340] " marxin at gcc dot gnu.org
@ 2021-03-02 12:36 ` rguenth at gcc dot gnu.org
  2021-03-02 12:46 ` doko at debian dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-02 12:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
PIC allows interposing ags_midi_buffer_util_get_varlength and thus possibly
initializing the argument.  PIE does not allow this so we see it is not
initialized.

I suppose the change on the branch is for some unreduced testcase where
different optimization might trigger the new warning (correctly I think).

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

* [Bug c/99340] -Werror=maybe-uninitialized warning with -fPIE, but not -fPIC
  2021-03-02 12:04 [Bug c/99340] New: [10/11 Regression] -Werror=maybe-uninitialized warning with -fPIE, but not -fPIC doko at debian dot org
  2021-03-02 12:10 ` [Bug c/99340] " marxin at gcc dot gnu.org
  2021-03-02 12:36 ` [Bug c/99340] " rguenth at gcc dot gnu.org
@ 2021-03-02 12:46 ` doko at debian dot org
  2021-03-02 12:51 ` marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: doko at debian dot org @ 2021-03-02 12:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Matthias Klose <doko at debian dot org> ---
Created attachment 50284
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50284&action=edit
preprocessed source

original test case before reducing

gcc -std=gnu99 -Werror=uninitialized -Werror=maybe-uninitialized -Wall
-Wno-unused-variable -Wno-unused-but-set-variable -Wformat -Wno-pointer-sign
-Werror=format-security -fstack-protector-strong -fPIC -O2 -c
ags_midi_buffer_util_orig.i

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

* [Bug c/99340] -Werror=maybe-uninitialized warning with -fPIE, but not -fPIC
  2021-03-02 12:04 [Bug c/99340] New: [10/11 Regression] -Werror=maybe-uninitialized warning with -fPIE, but not -fPIC doko at debian dot org
                   ` (2 preceding siblings ...)
  2021-03-02 12:46 ` doko at debian dot org
@ 2021-03-02 12:51 ` marxin at gcc dot gnu.org
  2021-03-02 13:05 ` marxin at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-03-02 12:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Matthias Klose from comment #3)
> Created attachment 50284 [details]
> preprocessed source
> 
> original test case before reducing
> 
> gcc -std=gnu99 -Werror=uninitialized -Werror=maybe-uninitialized -Wall
> -Wno-unused-variable -Wno-unused-but-set-variable -Wformat -Wno-pointer-sign
> -Werror=format-security -fstack-protector-strong -fPIC -O2 -c
> ags_midi_buffer_util_orig.i

Using this with -fPIE reports the warning only on gcc-10 branch. All other is
fine.

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

* [Bug c/99340] -Werror=maybe-uninitialized warning with -fPIE, but not -fPIC
  2021-03-02 12:04 [Bug c/99340] New: [10/11 Regression] -Werror=maybe-uninitialized warning with -fPIE, but not -fPIC doko at debian dot org
                   ` (3 preceding siblings ...)
  2021-03-02 12:51 ` marxin at gcc dot gnu.org
@ 2021-03-02 13:05 ` marxin at gcc dot gnu.org
  2021-03-02 13:45 ` rguenth at gcc dot gnu.org
  2021-04-12 19:28 ` msebor at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-03-02 13:05 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
                 CC|                            |rguenth at gcc dot gnu.org

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
Started on gcc-10 branch with g:eddcb627ccfbd97e025cf366cc3f3bad76211785.
Anyway, the warning contains quite some false positives..

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

* [Bug c/99340] -Werror=maybe-uninitialized warning with -fPIE, but not -fPIC
  2021-03-02 12:04 [Bug c/99340] New: [10/11 Regression] -Werror=maybe-uninitialized warning with -fPIE, but not -fPIC doko at debian dot org
                   ` (4 preceding siblings ...)
  2021-03-02 13:05 ` marxin at gcc dot gnu.org
@ 2021-03-02 13:45 ` rguenth at gcc dot gnu.org
  2021-04-12 19:28 ` msebor at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-02 13:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 warns as well.  I think this was a false negative which is now fixed.

Note GCC 10.1.0 and GCC 10.2.0 warn for me as well, so something must have
regressed this between 10.2.0 and g:eddcb627ccfbd97e025cf366

I'm inclined to mark as INVALID.

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

* [Bug c/99340] -Werror=maybe-uninitialized warning with -fPIE, but not -fPIC
  2021-03-02 12:04 [Bug c/99340] New: [10/11 Regression] -Werror=maybe-uninitialized warning with -fPIE, but not -fPIC doko at debian dot org
                   ` (5 preceding siblings ...)
  2021-03-02 13:45 ` rguenth at gcc dot gnu.org
@ 2021-04-12 19:28 ` msebor at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-04-12 19:28 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID
                 CC|                            |msebor at gcc dot gnu.org
           Keywords|                            |diagnostic
             Blocks|                            |24639

--- Comment #7 from Martin Sebor <msebor at gcc dot gnu.org> ---
The IL with -fPIC shows a call to ags_midi_buffer_util_get_varlength() while
the IL with -fPIE has the call expanded inline, which is what less the warning
see current_delta_time is not initialized.   With that, resolving as invalid
per c6.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24639
[Bug 24639] [meta-bug] bug to track all Wuninitialized issues

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

end of thread, other threads:[~2021-04-12 19:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-02 12:04 [Bug c/99340] New: [10/11 Regression] -Werror=maybe-uninitialized warning with -fPIE, but not -fPIC doko at debian dot org
2021-03-02 12:10 ` [Bug c/99340] " marxin at gcc dot gnu.org
2021-03-02 12:36 ` [Bug c/99340] " rguenth at gcc dot gnu.org
2021-03-02 12:46 ` doko at debian dot org
2021-03-02 12:51 ` marxin at gcc dot gnu.org
2021-03-02 13:05 ` marxin at gcc dot gnu.org
2021-03-02 13:45 ` rguenth at gcc dot gnu.org
2021-04-12 19:28 ` msebor at gcc dot gnu.org

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