[Bug libgomp/89137] New: gcc/omp-low.c:7135: possible read of uninit memory ?

dcb314 at hotmail dot com gcc-bugzilla@gcc.gnu.org
Thu Jan 31 10:38:00 GMT 2019


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

            Bug ID: 89137
           Summary: gcc/omp-low.c:7135: possible read of uninit memory ?
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgomp
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

gcc/omp-low.c:7135:13: warning: variable 'c' is used uninitialized whenever
'if' condition is false [-Wsometimes-uninitialized]

Source code is

          tree c;
          tree lab5 = create_artificial_label (UNKNOWN_LOCATION);
          tree lab6 = create_artificial_label (UNKNOWN_LOCATION);
          lab3 = create_artificial_label (UNKNOWN_LOCATION);
          if (code == OMP_FOR)
            c = gimple_omp_for_clauses (ctx->stmt);
          else if (code == OMP_SECTIONS)
            c = gimple_omp_sections_clauses (ctx->stmt);
          c = OMP_CLAUSE_DECL (omp_find_clause (c, OMP_CLAUSE__REDUCTEMP_));

Might it be worthwhile to put in extra code for the case where
local variable code isn't one of the expected values ?

Maybe

         else
             assert( 0); /* Shouldn't get here */


More information about the Gcc-bugs mailing list