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

            Bug ID: 88058
           Summary: gcc fails to detect use of out of scope variable ?
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

Generalising from bugs # 88056 and # 88057,
for the following code, gcc says nothing:

extern void g( char *);

void f( int n, char * p1)
{
        char * p2;

        p2 = p1;

        if (n >= 0)
        {
                char buf[ 10];

                p2 = buf;
        }
        g( p2);  // Bang !
}

$ ~/gcc/results/bin/gcc -c -O2 -Wall -Wextra nov16a.cc
$

Reply via email to