public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/115587] New: Possible uninitialized variable (decl) in c_parser_omp_loop_nest
@ 2024-06-22  4:19 pinskia at gcc dot gnu.org
  2024-06-22  4:24 ` [Bug c/115587] [14/15 Regression] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-22  4:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115587
           Summary: Possible uninitialized variable (decl) in
                    c_parser_omp_loop_nest
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: internal-improvement, openmp
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

clang gives the following warning:
```
/home/worker/buildworker/tiber-gcc-clang/build/gcc/c/c-parser.cc:22585:12:
warning: variable 'decl' is used uninitialized whenever '&&' condition is false
[-Wsometimes-uninitialized]
/home/worker/buildworker/tiber-gcc-clang/build/gcc/c/c-parser.cc:22585:12:
warning: variable 'decl' is used uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
```
I looked into the code and it does look like decl could be used uninitialized.
It is a complex path to get there though so it is hard to tell.
It is also only on the error path and it does not look like it would cause any
issues to be used here uninitialized though since it is never accessed directly
on that path.

I think initializing it to null after error_init, will fix the warning and have
the same effect as right now.
But someone who knows this code better should look into it.

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

* [Bug c/115587] [14/15 Regression] Possible uninitialized variable (decl) in c_parser_omp_loop_nest
  2024-06-22  4:19 [Bug c/115587] New: Possible uninitialized variable (decl) in c_parser_omp_loop_nest pinskia at gcc dot gnu.org
@ 2024-06-22  4:24 ` pinskia at gcc dot gnu.org
  2024-06-22 12:29 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-22  4:24 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Possible uninitialized      |[14/15 Regression] Possible
                   |variable (decl) in          |uninitialized variable
                   |c_parser_omp_loop_nest      |(decl) in
                   |                            |c_parser_omp_loop_nest
                 CC|                            |sandra at gcc dot gnu.org

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Function/bad code was introduced with r14-3489-g143151ac2013c2 .

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

* [Bug c/115587] [14/15 Regression] Possible uninitialized variable (decl) in c_parser_omp_loop_nest
  2024-06-22  4:19 [Bug c/115587] New: Possible uninitialized variable (decl) in c_parser_omp_loop_nest pinskia at gcc dot gnu.org
  2024-06-22  4:24 ` [Bug c/115587] [14/15 Regression] " pinskia at gcc dot gnu.org
@ 2024-06-22 12:29 ` rguenth at gcc dot gnu.org
  2024-06-23  4:17 ` sandra at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-06-22 12:29 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.2

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

* [Bug c/115587] [14/15 Regression] Possible uninitialized variable (decl) in c_parser_omp_loop_nest
  2024-06-22  4:19 [Bug c/115587] New: Possible uninitialized variable (decl) in c_parser_omp_loop_nest pinskia at gcc dot gnu.org
  2024-06-22  4:24 ` [Bug c/115587] [14/15 Regression] " pinskia at gcc dot gnu.org
  2024-06-22 12:29 ` rguenth at gcc dot gnu.org
@ 2024-06-23  4:17 ` sandra at gcc dot gnu.org
  2024-06-23  4:19 ` [Bug c/115587] [14/15 Regression] Possible uninitialized variable (decl) in c_parser_omp_loop_nest since r14-3489-g143151ac2013c2 sjames at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: sandra at gcc dot gnu.org @ 2024-06-23  4:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from sandra at gcc dot gnu.org ---
I'll take care of this.

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

* [Bug c/115587] [14/15 Regression] Possible uninitialized variable (decl) in c_parser_omp_loop_nest since r14-3489-g143151ac2013c2
  2024-06-22  4:19 [Bug c/115587] New: Possible uninitialized variable (decl) in c_parser_omp_loop_nest pinskia at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-06-23  4:17 ` sandra at gcc dot gnu.org
@ 2024-06-23  4:19 ` sjames at gcc dot gnu.org
  2024-06-25 14:29 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-06-23  4:19 UTC (permalink / raw)
  To: gcc-bugs

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

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2024-06-23
     Ever confirmed|0                           |1
            Summary|[14/15 Regression] Possible |[14/15 Regression] Possible
                   |uninitialized variable      |uninitialized variable
                   |(decl) in                   |(decl) in
                   |c_parser_omp_loop_nest      |c_parser_omp_loop_nest
                   |                            |since
                   |                            |r14-3489-g143151ac2013c2

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

* [Bug c/115587] [14/15 Regression] Possible uninitialized variable (decl) in c_parser_omp_loop_nest since r14-3489-g143151ac2013c2
  2024-06-22  4:19 [Bug c/115587] New: Possible uninitialized variable (decl) in c_parser_omp_loop_nest pinskia at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-06-23  4:19 ` [Bug c/115587] [14/15 Regression] Possible uninitialized variable (decl) in c_parser_omp_loop_nest since r14-3489-g143151ac2013c2 sjames at gcc dot gnu.org
@ 2024-06-25 14:29 ` cvs-commit at gcc dot gnu.org
  2024-06-25 14:35 ` sandra at gcc dot gnu.org
  2024-06-25 21:47 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-25 14:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Sandra Loosemore <sandra@gcc.gnu.org>:

https://gcc.gnu.org/g:21f1073d388af8af207183b0ed592e1cc47d20ab

commit r15-1613-g21f1073d388af8af207183b0ed592e1cc47d20ab
Author: Sandra Loosemore <sloosemore@baylibre.com>
Date:   Tue Jun 25 13:54:43 2024 +0000

    Fix PR c/115587, uninitialized variable in c_parser_omp_loop_nest

    This function had a reference to an uninitialized variable on the
    error path.  The problem was diagnosed by clang but not gcc.  It seems
    the cleanest solution is to initialize all the loop-clause variables
    at the point of declaration rather than at different places in the
    code.

    The C++ front end didn't have this problem, but I've made similar
    changes there to keep the code in sync.

    gcc/c/ChangeLog:

            PR c/115587
            * c-parser.cc (c_parser_omp_loop_nest): Move initializations to
            point of declaration.

    gcc/cp/ChangeLog:

            PR c/115587
            * parser.cc (cp_parser_omp_loop_nest): Move initializations to
            point of declaration.

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

* [Bug c/115587] [14/15 Regression] Possible uninitialized variable (decl) in c_parser_omp_loop_nest since r14-3489-g143151ac2013c2
  2024-06-22  4:19 [Bug c/115587] New: Possible uninitialized variable (decl) in c_parser_omp_loop_nest pinskia at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-06-25 14:29 ` cvs-commit at gcc dot gnu.org
@ 2024-06-25 14:35 ` sandra at gcc dot gnu.org
  2024-06-25 21:47 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: sandra at gcc dot gnu.org @ 2024-06-25 14:35 UTC (permalink / raw)
  To: gcc-bugs

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

sandra at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #4 from sandra at gcc dot gnu.org ---
Patch pushed to the mainline as obvious.  I'll backport to the GCC 14 branch as
well since this was tagged as a regression on that branch.

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

* [Bug c/115587] [14/15 Regression] Possible uninitialized variable (decl) in c_parser_omp_loop_nest since r14-3489-g143151ac2013c2
  2024-06-22  4:19 [Bug c/115587] New: Possible uninitialized variable (decl) in c_parser_omp_loop_nest pinskia at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-06-25 14:35 ` sandra at gcc dot gnu.org
@ 2024-06-25 21:47 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-25 21:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Sandra Loosemore
<sandra@gcc.gnu.org>:

https://gcc.gnu.org/g:b383719aebe45bbe8cc3944e515ed7caa30e8744

commit r14-10346-gb383719aebe45bbe8cc3944e515ed7caa30e8744
Author: Sandra Loosemore <sloosemore@baylibre.com>
Date:   Tue Jun 25 13:54:43 2024 +0000

    Fix PR c/115587, uninitialized variable in c_parser_omp_loop_nest

    This function had a reference to an uninitialized variable on the
    error path.  The problem was diagnosed by clang but not gcc.  It seems
    the cleanest solution is to initialize all the loop-clause variables
    at the point of declaration rather than at different places in the
    code.

    The C++ front end didn't have this problem, but I've made similar
    changes there to keep the code in sync.

    gcc/c/ChangeLog:

            PR c/115587
            * c-parser.cc (c_parser_omp_loop_nest): Move initializations to
            point of declaration.

    gcc/cp/ChangeLog:

            PR c/115587
            * parser.cc (cp_parser_omp_loop_nest): Move initializations to
            point of declaration.

    (cherry picked from commit 21f1073d388af8af207183b0ed592e1cc47d20ab)

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

end of thread, other threads:[~2024-06-25 21:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-22  4:19 [Bug c/115587] New: Possible uninitialized variable (decl) in c_parser_omp_loop_nest pinskia at gcc dot gnu.org
2024-06-22  4:24 ` [Bug c/115587] [14/15 Regression] " pinskia at gcc dot gnu.org
2024-06-22 12:29 ` rguenth at gcc dot gnu.org
2024-06-23  4:17 ` sandra at gcc dot gnu.org
2024-06-23  4:19 ` [Bug c/115587] [14/15 Regression] Possible uninitialized variable (decl) in c_parser_omp_loop_nest since r14-3489-g143151ac2013c2 sjames at gcc dot gnu.org
2024-06-25 14:29 ` cvs-commit at gcc dot gnu.org
2024-06-25 14:35 ` sandra at gcc dot gnu.org
2024-06-25 21:47 ` cvs-commit 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).