public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/41823]  New: gcc/fortran/trans-openmp.c: possible null pointer dereference
@ 2009-10-25 11:11 dcb314 at hotmail dot com
  0 siblings, 0 replies; only message in thread
From: dcb314 at hotmail dot com @ 2009-10-25 11:11 UTC (permalink / raw)
  To: gcc-bugs

I just had a look at the source code file
gcc/fortran/trans-openmp.c,
function gfc_trans_omp_do.

I notice the following code

  gfc_omp_clauses *clauses = code->ext.omp_clauses;
  gfc_code *outermost;
  int i, collapse = clauses->collapse;

where the assumption is made that local variable "clauses" is non-NULL
and so local variable "collapse" can be assigned to ok.

Later code is

  for (i = 0; i < collapse; i++)
    {
      int simple = 0;
      int dovar_found = 0;

      if (clauses)

where a test is made for local variable "clauses" to be NULL or not.

Suggest code rework to cope with clauses being NULL. Maybe the following
untested code would be enough

  int i, collapse = (clauses ? clauses->collapse : 0);


-- 
           Summary: gcc/fortran/trans-openmp.c: possible null pointer
                    dereference
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dcb314 at hotmail dot com
  GCC host triplet: x86_64-suse-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41823


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-10-25 11:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-25 11:11 [Bug fortran/41823] New: gcc/fortran/trans-openmp.c: possible null pointer dereference dcb314 at hotmail dot com

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).