Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal compiler error when compiling giac-1.4.9.45 with gcc-7.2.0 #24599

Closed
rwst opened this issue Jan 28, 2018 · 21 comments
Closed

Internal compiler error when compiling giac-1.4.9.45 with gcc-7.2.0 #24599

rwst opened this issue Jan 28, 2018 · 21 comments

Comments

@rwst
Copy link

rwst commented Jan 28, 2018

gcc-7.2.0 is currently distributed with Sage. Complete log is attached.

[giac-1.4.9.45] modpoly.cc: In function 'std::complex<double> giac::horner_newton(const vecteur&, const std::complex<double>&, const giac::context*)':
[giac-1.4.9.45] modpoly.cc:5035:19: internal compiler error: Aborted
[giac-1.4.9.45]    complex<double> horner_newton(const vecteur & p,const std::complex<double> &x,GIAC_CONTEXT){
[giac-1.4.9.45]                    ^~~~~~~~~~~~~
[giac-1.4.9.45] 0xafbc6f crash_signal
[giac-1.4.9.45] 	../../src/gcc/toplev.c:337
[giac-1.4.9.45] 0x7f3e0cfeedd3 mpfr_assert_fail
[giac-1.4.9.45] 	/home/ralf/sage/local/var/tmp/sage/build/mpfr-3.1.5.p0/src/src/mpfr-gmp.c:305
[giac-1.4.9.45] 0x7f3e0cfe59c1 mpfr_init2
[giac-1.4.9.45] 	/home/ralf/sage/local/var/tmp/sage/build/mpfr-3.1.5.p0/src/src/init2.c:52
[giac-1.4.9.45] 0x7f3e0d21b472 mpc_div_zero
[giac-1.4.9.45] 	/home/ralf/sage/local/var/tmp/sage/build/mpc-1.1.0/src/src/div.c:31
[giac-1.4.9.45] 0x7f3e0d21b472 mpc_div
[giac-1.4.9.45] 	/home/ralf/sage/local/var/tmp/sage/build/mpc-1.1.0/src/src/div.c:257
[giac-1.4.9.45] 0x77b6b9 do_mpc_arg2(tree_node*, tree_node*, tree_node*, int, int (*)(__mpc_struct*, __mpc_struct const*, __mpc_struct const*, int))
[giac-1.4.9.45] 	../../src/gcc/builtins.c:10179
[giac-1.4.9.45] 0x8afa0a const_binop
[giac-1.4.9.45] 	../../src/gcc/fold-const.c:1316
[giac-1.4.9.45] 0x8b0c5e const_binop(tree_code, tree_node*, tree_node*, tree_node*)
[giac-1.4.9.45] 	../../src/gcc/fold-const.c:1565
[giac-1.4.9.45] 0xdb4962 gimple_resimplify2(gimple**, code_helper*, tree_node*, tree_node**, tree_node* (*)(tree_node*))
[giac-1.4.9.45] 	../../src/gcc/gimple-match-head.c:132
[giac-1.4.9.45] 0xe384b0 gimple_simplify(gimple*, code_helper*, tree_node**, gimple**, tree_node* (*)(tree_node*), tree_node* (*)(tree_node*))
[giac-1.4.9.45] 	../../src/gcc/gimple-match-head.c:642
[giac-1.4.9.45] 0x8e4306 fold_stmt_1
[giac-1.4.9.45] 	../../src/gcc/gimple-fold.c:4362
[giac-1.4.9.45] 0xbdb5ff execute
[giac-1.4.9.45] 	../../src/gcc/tree-ssa-forwprop.c:2391
[giac-1.4.9.45] Please submit a full bug report,

Minimal crashing example:

#include <complex>
auto inf = 1.0 / std::complex<double>();

The underlying reason is that, in #24353, the MPC upgrade did not change the .so version number but the MPFR upgrade did change the .so version number. So now GCC is linking with the old MPFR but the new MPC which is what causes the breakage...

Component: build

Author: Jeroen Demeyer

Branch/Commit: c7b0dac

Reviewer: Ralf Stephan

Issue created by migration from https://trac.sagemath.org/ticket/24599

@rwst rwst added this to the sage-8.2 milestone Jan 28, 2018
@kiwifb
Copy link
Member

kiwifb commented Jan 28, 2018

comment:1

Attachment: giac-1.4.9.45.log

Because gcc links to mpfr/mpc and there is a change of soname from mpfr (so.4 to so.6) gcc needs to be rebuilt. Currently mpfr is only a built order dependency because there wasn't a change in soname for a long time it was fine. But it looks like this need to be changed.

@rwst
Copy link
Author

rwst commented Jan 28, 2018

comment:2

OTOH, mpfr depends on gcc so gcc cannot depend on mpfr. If gcc really uses mpfr as it looks like then I think mpfr needs to be compiled before gcc, i.e. using the system gcc.

@kiwifb
Copy link
Member

kiwifb commented Jan 28, 2018

comment:3

mpfr doesn't depend on gcc

cat build/pkgs/mpfr/dependencies 
$(MP_LIBRARY)

----------
All lines of this file are ignored except the first.
It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile.

but gcc does depend on mpfr - but only build order dependency, that is gcc is not rebuilt after an mpfr upgrade (which is fine as long as the soname doesn't change either)

cat build/pkgs/gcc/dependencies 
| $(MP_LIBRARY) mpfr mpc zlib xz

----------
All lines of this file are ignored except the first.
It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile.

Same thing for MP_LIBRARY, mpc and zlib really. xz is only needed to unpack the tarball.

@rwst
Copy link
Author

rwst commented Jan 28, 2018

comment:4

Well, I can only say that just now mpfr was rebuilt after I reinstalled gcc and said make so there is some dependency.

@kiwifb
Copy link
Member

kiwifb commented Jan 28, 2018

comment:5

Ha! That's because of the way the gcc spkg - and the sage toolchain is set up. The gcc spkg ends with this

# Force re-installation of gmp, mpir, mpfr and mpc with the GCC we just built.
cd "$SAGE_SPKG_INST"
rm -f gmp-* mpir-* mpfr-* mpc-*

# Force re-configuration: the next time that "make" is run, we don't
# want GCC to be built again, see Trac #19324
touch "$SAGE_ROOT/configure"

@rwst
Copy link
Author

rwst commented Jan 28, 2018

comment:6

As to the root cause what I don't understand is that gcc usually builds all its libraries itself, but with mpfr they depend on a shared library. I think that is the problem.

@jdemeyer

This comment has been minimized.

@jdemeyer

This comment has been minimized.

@jdemeyer
Copy link

comment:8

I don't see an obvious solution...

@jdemeyer
Copy link

comment:9

The problem is that there is no logic in configure.ac to check whether the Sage-installed GCC actually works... we just assume that it does.

@jdemeyer
Copy link

Branch: u/jdemeyer/ticket/24599

@jdemeyer
Copy link

Commit: 0ee2274

@jdemeyer
Copy link

Author: Jeroen Demeyer

@jdemeyer
Copy link

New commits:

0ee2274Check for broken g++ in $SAGE_LOCAL

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 29, 2018

Changed commit from 0ee2274 to c7b0dac

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 29, 2018

Branch pushed to git repo; I updated commit sha1. New commits:

c7b0dacLibraries should be real dependencies

@kiwifb
Copy link
Member

kiwifb commented Jan 29, 2018

comment:13

Good find on the minimal example. I think this will work so it is positive for me but Ralph should test it - if he can before setting the ticket to positive review.

@rwst
Copy link
Author

rwst commented Jan 30, 2018

comment:14

It seems -O3 is needed for the ICE. What I did:

> make distclean
> git checkout 8.2.beta3
> ./sage -f mpfr
> ./sage -f gcc
> git checkout 8.2.beta4
> ./sage -f giac

As expected this fails again with the same error. Then I put the snippet into t.cpp and did ./local/bin/g++ -c -O3 t.cpp which also fails.

@rwst
Copy link
Author

rwst commented Jan 30, 2018

comment:15

Then I did git pull trac u/jdemeyer/ticket/24599 (EDIT: and make start) in a branch and gcc was recompiled.

@rwst
Copy link
Author

rwst commented Jan 30, 2018

Reviewer: Ralf Stephan

@vbraun
Copy link
Member

vbraun commented Feb 2, 2018

Changed branch from u/jdemeyer/ticket/24599 to c7b0dac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants