[Bug middle-end/105867] New: incorrect dangling-pointer warning

gman at chromium dot org gcc-bugzilla@gcc.gnu.org
Tue Jun 7 00:13:59 GMT 2022


            Bug ID: 105867
           Summary: incorrect dangling-pointer warning
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gman at chromium dot org
  Target Milestone: ---

Created attachment 53094
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53094&action=edit
dangling-pointer warning repo

This code (attached) could be doing something wrong but I was asked to look
into why this code gets an dangling-pointer warning in gcc 12.1 and after
looking though it it seems like maybe the code is fine and the warning is

compiled with 

-std=c++17 -Wall -Wextra -pedantic-errors -Wdangling-pointer -O2

note that there is a function, TIntermRebuild::printStack, which is called in
several places. It's inclusion doesn't seem like it should affect the warning.
As it is it is compiled out via a macro

    #define printStack(msg)

compiling it back in (delete the line above) makes the warning go away.

More information about the Gcc-bugs mailing list