When running the full testsuite with -mcmodel=medium, several tests FAIL
with a NULL pointer dereference as described in the PR.

Since these calls ultimately originate from get_named_section(NULL_TREE,
...) calls, the obvious fix seems the right thing to do.

Bootstrapped without regressions on x86_64-pc-linux-gnu, followed by an
additional testsuite run with -mcmodel=medium.  The only changes present
are those reported in PR target/71097, and I've verified that they also
exist on the gcc-6 branch, i.e. without my patch.

Ok for mainline?

        Rainer


2016-05-12  Rainer Orth  <r...@cebitec.uni-bielefeld.de>

        PR target/71080
        * config/i386/i386.c (ix86_in_large_data_p): Guard against NULL exp.

# HG changeset patch
# Parent  df465f483742f325ab7a60c2058cd31681949212
Fix SEGV in ix86_in_large_data_p (PR target/71080)

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -6823,6 +6823,9 @@ ix86_in_large_data_p (tree exp)
   if (ix86_cmodel != CM_MEDIUM && ix86_cmodel != CM_MEDIUM_PIC)
     return false;
 
+  if (exp == NULL_TREE)
+    return false;
+
   /* Functions are never large data.  */
   if (TREE_CODE (exp) == FUNCTION_DECL)
     return false;
-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Reply via email to