public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/62142] New: internal compiler error: Segmentation fault (X = X - L*floor(X/L))
@ 2014-08-14 17:56 ondrej.certik at gmail dot com
  2014-08-14 18:55 ` [Bug fortran/62142] " ondrej.certik at gmail dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: ondrej.certik at gmail dot com @ 2014-08-14 17:56 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 62142
           Summary: internal compiler error: Segmentation fault (X = X -
                    L*floor(X/L))
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ondrej.certik at gmail dot com

Created attachment 33327
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33327&action=edit
Source file to reproduce the segfault

$ cat test_segfault.f90 
program test_segfault
implicit none
integer, parameter :: dp=kind(0.d0)
real(dp) :: L
real(dp), allocatable :: X(:)
X = X - L*floor(X/L)
end program

$ gfortran -v test_segfault.f90 
Driving: gfortran -v test_segfault.f90 -l gfortran -l m -shared-libgcc
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/local/certik/bld/gcc/5att4mtprf52/libexec/gcc/x86_64-unknown-linux-gnu/4.9.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --prefix=/local/certik/bld/gcc/5att4mtprf52
--enable-checking=release --enable-languages=fortran,c,c++
--with-local-prefix=/local/certik/bld/gcc/5att4mtprf52
--with-gmp=/local/certik/bld/gmp/vadkrj43wtyr
--with-mpc=/local/certik/bld/mpc/sushaq7ufe2f
--with-mpfr=/local/certik/bld/mpfr/vxwmnxjsshse
--with-cloog=/local/certik/bld/cloog/x3kd73rwqkzj
--with-isl=/local/certik/bld/isl/lfrjunwloawr --enable-clocale=gnu
--enable-__cxa_atexit --enable-shared --enable-threads=posix --disable-multilib
--libdir=/local/certik/bld/gcc/5att4mtprf52/lib
--with-stage1-ldflags='-L/local/certik/bld/cloog/x3kd73rwqkzj/lib
-Wl,-rpath=/local/certik/bld/cloog/x3kd73rwqkzj/lib
-L/local/certik/bld/gmp/vadkrj43wtyr/lib
-Wl,-rpath=/local/certik/bld/gmp/vadkrj43wtyr/lib
-L/local/certik/bld/isl/lfrjunwloawr/lib
-Wl,-rpath=/local/certik/bld/isl/lfrjunwloawr/lib
-L/local/certik/bld/mpc/sushaq7ufe2f/lib
-Wl,-rpath=/local/certik/bld/mpc/sushaq7ufe2f/lib
-L/local/certik/bld/mpfr/vxwmnxjsshse/lib
-Wl,-rpath=/local/certik/bld/mpfr/vxwmnxjsshse/lib
-L/local/certik/bld/patchelf/k3rloj265ogt/lib
-Wl,-rpath=/local/certik/bld/patchelf/k3rloj265ogt/lib
-L/local/certik/bld/zlib/3el5ccejre7b/lib
-Wl,-rpath=/local/certik/bld/zlib/3el5ccejre7b/lib'
--with-boot-ldflags='-L/local/certik/bld/cloog/x3kd73rwqkzj/lib
-Wl,-rpath=/local/certik/bld/cloog/x3kd73rwqkzj/lib
-L/local/certik/bld/gmp/vadkrj43wtyr/lib
-Wl,-rpath=/local/certik/bld/gmp/vadkrj43wtyr/lib
-L/local/certik/bld/isl/lfrjunwloawr/lib
-Wl,-rpath=/local/certik/bld/isl/lfrjunwloawr/lib
-L/local/certik/bld/mpc/sushaq7ufe2f/lib
-Wl,-rpath=/local/certik/bld/mpc/sushaq7ufe2f/lib
-L/local/certik/bld/mpfr/vxwmnxjsshse/lib
-Wl,-rpath=/local/certik/bld/mpfr/vxwmnxjsshse/lib
-L/local/certik/bld/patchelf/k3rloj265ogt/lib
-Wl,-rpath=/local/certik/bld/patchelf/k3rloj265ogt/lib
-L/local/certik/bld/zlib/3el5ccejre7b/lib
-Wl,-rpath=/local/certik/bld/zlib/3el5ccejre7b/lib'
Thread model: posix
gcc version 4.9.1 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'

/local/certik/bld/gcc/5att4mtprf52/libexec/gcc/x86_64-unknown-linux-gnu/4.9.1/f951
test_segfault.f90 -quiet -dumpbase test_segfault.f90 -mtune=generic
-march=x86-64 -auxbase test_segfault -version -fintrinsic-modules-path
/local/certik/bld/gcc/5att4mtprf52/lib/gcc/x86_64-unknown-linux-gnu/4.9.1/finclude
-o /tmp/ccliCcO4.s
GNU Fortran (GCC) version 4.9.1 (x86_64-unknown-linux-gnu)
    compiled by GNU C version 4.9.1, GMP version 5.1.3, MPFR version 3.1.2, MPC
version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Fortran (GCC) version 4.9.1 (x86_64-unknown-linux-gnu)
    compiled by GNU C version 4.9.1, GMP version 5.1.3, MPFR version 3.1.2, MPC
version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
test_segfault.f90: In function ‘test_segfault’:
test_segfault.f90:6:0: internal compiler error: Segmentation fault
 X = X - L*floor(X/L)
 ^
0x90f44f crash_signal
    ../.././gcc/toplev.c:337
0x604e0d is_runtime_conformable
    ../.././gcc/fortran/trans-expr.c:7856
0x604e1b is_runtime_conformable
    ../.././gcc/fortran/trans-expr.c:7856
0x611aa4 gfc_trans_assignment_1
    ../.././gcc/fortran/trans-expr.c:8117
0x5e3fc5 trans_code
    ../.././gcc/fortran/trans.c:1639
0x6033bb gfc_generate_function_code(gfc_namespace*)
    ../.././gcc/fortran/trans-decl.c:5653
0x5a2f80 translate_all_program_units
    ../.././gcc/fortran/parse.c:4953
0x5a2f80 gfc_parse_file()
    ../.././gcc/fortran/parse.c:5150
0x5e0025 gfc_be_parse_file
    ../.././gcc/fortran/f95-lang.c:212
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


When I execute "gfortran -v -save-temps  test_segfault.f90", it doesn't produce
preprocessed sources, I assume the segfault happens in the parser. I have
isolated the segfault, it happens in a large codebase and prevents its
compilation (the array is allocated in our code, the above is the simplest code
to reproduce the problem).

This is my first bug report, please let me know if you need further
information.
>From gcc-bugs-return-458492-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Aug 14 18:10:54 2014
Return-Path: <gcc-bugs-return-458492-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 32441 invoked by alias); 14 Aug 2014 18:10:53 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 32404 invoked by uid 55); 14 Aug 2014 18:10:48 -0000
From: "hubicka at ucw dot cz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/62071] [4.10 Regression] ICE: in before_dom_children, at tree-ssa-pre.c:4411
Date: Thu, 14 Aug 2014 18:10:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: hubicka at ucw dot cz
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-62071-4-zzvOgC2j2h@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-62071-4@http.gcc.gnu.org/bugzilla/>
References: <bug-62071-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-08/txt/msg00989.txt.bz2
Content-length: 1836

https://gcc.gnu.org/bugzilla/show_bug.cgi?idb071

--- Comment #3 from Jan Hubicka <hubicka at ucw dot cz> ---
Hi,
There are two issues seen with the testcase.  First is that ipa-devirt misses
the ctor call that can be easily fixed by:
Index: ipa-devirt.c
==================================================================--- ipa-devirt.c        (revision 213969)
+++ ipa-devirt.c        (working copy)
@@ -2663,6 +2663,8 @@
                          * BITS_PER_UNIT;
                op = TREE_OPERAND (op, 0);
              }
+           else if (DECL_P (op))
+             ;
            else
              {
                 tci->speculative = true;

I am testing this patch.

However even with this change we won't devirtualize because we believe that we
can not reffer to the virtual method.
The node is:
(gdb) p snode->dump (stderr)
_ZNK1A5m_fn1Ev/3 (virtual SnmpSyntax* A::m_fn1() const) @0x7ffff6dad8a0
  Type: function definition analyzed
  Visibility: external public weak comdat comdat_group:_ZNK1A5m_fn1Ev one_only
virtual
  Address is taken.
  References:
  Referring: _ZTV1A/12 (addr)
  Availability: available
  First run: 0
  Function flags: body
  Called by:
  Calls:

I wonder what we should do with both external and comdat here.  Jason, can we
devirtualize?
The constructor is keyed to other compilation unit here, but we are provided
with a body
that we will never use (modulo the tree-ssa-pre bug that brings the reference
into code).

I can imagine implementing logic to make us to devirtualize only when inlining
and never introduce
direct refernece otherwise, but it would be quite work - so far we always need
the intermediate
reference before inlining. (Basically we will need to make ipa-devirt to
produce direct call and
revert if inliner fails to inline the function at the end of IPA queue).

Honza


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-08-16  9:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-14 17:56 [Bug fortran/62142] New: internal compiler error: Segmentation fault (X = X - L*floor(X/L)) ondrej.certik at gmail dot com
2014-08-14 18:55 ` [Bug fortran/62142] " ondrej.certik at gmail dot com
2014-08-14 19:17 ` ondrej.certik at gmail dot com
2014-08-15  8:42 ` [Bug fortran/62142] [4.9/5 Regression] " dominiq at lps dot ens.fr
2014-08-15  8:52 ` dominiq at lps dot ens.fr
2014-08-15 10:02 ` rguenth at gcc dot gnu.org
2014-08-15 12:39 ` jakub at gcc dot gnu.org
2014-08-15 20:34 ` tkoenig at gcc dot gnu.org
2014-08-15 21:20 ` tkoenig at gcc dot gnu.org
2014-08-16  9:45 ` tkoenig at gcc dot gnu.org
2014-08-16  9:46 ` tkoenig at gcc dot gnu.org

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