This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/77425] New: Pointer test follows dereference in sched-int.h


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

            Bug ID: 77425
           Summary: Pointer test follows dereference in sched-int.h
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
            Blocks: 77421
  Target Milestone: ---

sd_iterator_cond in gcc/sched-int.h has:

              it_ptr->linkp = &DEPS_LIST_FIRST (list);

              if (list)
                continue;

where DEPS_LIST_FIRST dereferences list, so either the test is always true or
the dereference is undefined behavious.

Maybe it should be:

              it_ptr->linkp = list ? &DEPS_LIST_FIRST (list) : NULL;

              if (list)
                continue;


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77421
[Bug 77421] Bugs found in GCC with the help of PVS-Studio

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]