Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#20738 closed defect (fixed)

singular 3.1.7 fails to build using GCC 6

Reported by: aapitzsch Owned by:
Priority: major Milestone: sage-7.3
Component: build Keywords: GCC6 c++11
Cc: Merged in:
Authors: André Apitzsch Reviewers: Volker Braun
Report Upstream: N/A Work issues:
Branch: 04c0af9 (Commits) Commit:
Dependencies: Stopgaps:

Description

Till #17254 is ready. Let's add another patch to singular to fix a build issue with GCC 6.

Change History (15)

comment:1 Changed 3 years ago by aapitzsch

  • Status changed from new to needs_review

comment:2 Changed 3 years ago by fbissey

This looks like OS X bits (macho-bundles). Has it also been tested on pre gcc-6.1 compilers? I guess the bots will answer that question soon.

comment:3 follow-up: Changed 3 years ago by jdemeyer

Can you replace &mach_o[0] by mach_o for simplicity?

comment:4 Changed 3 years ago by git

  • Commit changed from d0da72bc61a8cb5976b4762b01c051e482dbe4f6 to 04c0af9477f794f5d00a1c813725049d340bf4bd

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

04c0af9replace &mach_o[0] by mach_o

comment:5 in reply to: ↑ 3 Changed 3 years ago by aapitzsch

Replying to jdemeyer:

Can you replace &mach_o[0] by mach_o for simplicity?

Done.

comment:6 Changed 3 years ago by leif

While this (or a similar patch I posted on sage-release) allows building Singular with GCC 6.1 (and without -std=c++98 or -std=c++11), the resulting binaries crash for me (even when compiled with -std=c++98).

Seems we have to fiddle with optimization flags as well, which doesn't necessarily mean it's GCC's fault.

IIRC, with -O1 in CPPFLAGS (which aren't consistently used or get overridden by other settings, just like CXXFLAGS), I obtained a version (of Sage 7.2 btw.) where ./sage and ./sage --singular did no longer segfault, but building the documentation still crashed...

(The previous segfaults happened immediately when initializing libsingular, as also reported by someone else on sage-release, in a thread for Sage 7.3.beta2 related to GCC 6.1 and BRiAl.)

comment:7 Changed 3 years ago by vbraun

  • Keywords c++11 added

comment:8 Changed 3 years ago by leif

My patch to Singular for C++11 is IMHO more straight-forward... ;-)

  • singular-3.1.7p1/kernel/mod_raw.cc

     
    3838
    3939lib_types type_of_LIB(char *newlib, char *libnamebuf)
    4040{
    41   const char mach_o[]={0xfe,0xed,0xfa,0xce,0};
    42   const char mach_o_module[]={0xce,0xfa,0xed,0xfe,0};
     41  const char mach_o[]="\xfe\xed\xfa\xce";
     42  const char mach_o_module[]="\xce\xfa\xed\xfe";
    4343  int i=0;
    4444  while(si_bultin_libs[i]!=NULL)
    4545  {

(I've put it into build/pkgs/singular/patches/remove_narrowing_conversion.patch.)

comment:9 Changed 3 years ago by leif

Just for the record:

If I compile everything except the Singular 3.1.7p1 package (the latter with GCC 5.4) with GCC 6.1.0, ptestlong passes for me (modulo the usual noise in one doctest, and two GAP tests which pass when rerun, but that's again the same as with GCC 5.x).

This still refers to Sage 7.2 (plus some work-arounds).

So the Singular problem appears to be a singular one. XD

comment:10 follow-up: Changed 3 years ago by vbraun

  • Reviewers set to Volker Braun
  • Status changed from needs_review to positive_review

Singular works with -fno-delete-null-pointer-checks, which I added at #20926

Last edited 3 years ago by vbraun (previous) (diff)

comment:11 in reply to: ↑ 10 ; follow-up: Changed 3 years ago by leif

Replying to vbraun:

Singular works with -fno-delete-null-pointer-checks, which I added at #20926

While it doesn't immediately crash, I'm getting doctest failures with that.

ptestlong hasn't (fully) finished yet, but it seems just because of a singular Singular process running 100%...

comment:12 in reply to: ↑ 11 Changed 3 years ago by leif

Replying to leif:

Replying to vbraun:

Singular works with -fno-delete-null-pointer-checks, which I added at #20926

While it doesn't immediately crash, I'm getting doctest failures with that.

ptestlong hasn't (fully) finished yet, but it seems just because of a singular Singular process running 100%...

That's the last test it was waiting for (with Singular 100% busy for a while):

sage -t --long src/sage/schemes/plane_conics/con_rational_function_field.py
    Timed out (and interrupt failed)
**********************************************************************
Tests run before process (pid=10413) timed out:
sage: K = FractionField(PolynomialRing(QQ, 't')) ## line 17 ##
sage: P.<X, Y, Z> = K[] ## line 18 ##
sage: Conic(X^2 + Y^2 - Z^2) ## line 19 ##
Projective Conic Curve over Fraction Field of Univariate Polynomial Ring in t over Rational Field defined by X^2 + Y^2 - Z^2
sage: K.<t> = FractionField(QQ['t']) ## line 26 ##
sage: C = Conic([1,-t,t]) ## line 27 ##
sage: C.has_rational_point(point = True) ## line 28 ##
(True, (0 : 1 : 1))
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 30 ##
0
sage: K = FractionField(PolynomialRing(QQ, 't')) ## line 58 ##
sage: P.<X, Y, Z> = K[] ## line 59 ##
sage: Conic(X^2 + Y^2 - Z^2) ## line 60 ##
Projective Conic Curve over Fraction Field of Univariate Polynomial Ring in t over Rational Field defined by X^2 + Y^2 - Z^2
sage: K = FractionField(PolynomialRing(QQ, 't')) ## line 67 ##
sage: Conic([K(1), 1, -1])._test_pickling() ## line 68 ##
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 76 ##
0
sage: c = Conic([1, 1, 1]); c ## line 83 ##
Projective Conic Curve over Rational Field defined by x^2 + y^2 + z^2
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 86 ##
0
sage: K.<t> = FractionField(PolynomialRing(QQ, 't')) ## line 129 ##
sage: C = Conic(K, [t^2-2, 2*t^3, -2*t^3-13*t^2-2*t+18]) ## line 130 ##
sage: C.has_rational_point() ## line 135 ##
True
sage: C.has_rational_point(point=True) ## line 137 ##
(True, (5*t : 8 : 1))
sage: F.<i> = QuadraticField(-1) ## line 139 ##
sage: R.<t> = F[] ## line 140 ##
sage: C = Conic([1,i*t,-t^2+4]) ## line 141 ##
sage: C.has_rational_point(point = True) ## line 142 ##
verbose 0 (3369: multi_polynomial_ideal.py, groebner_basis) Warning: falling back to very slow toy implementation.
verbose 0 (3369: multi_polynomial_ideal.py, groebner_basis) Warning: falling back to very slow toy implementation.
verbose 0 (3369: multi_polynomial_ideal.py, groebner_basis) Warning: falling back to very slow toy implementation.
verbose 0 (3369: multi_polynomial_ideal.py, groebner_basis) Warning: falling back to very slow toy implementation.
verbose 0 (3369: multi_polynomial_ideal.py, groebner_basis) Warning: falling back to very slow toy implementation.
verbose 0 (3369: multi_polynomial_ideal.py, groebner_basis) Warning: falling back to very slow toy implementation.
verbose 0 (3369: multi_polynomial_ideal.py, groebner_basis) Warning: falling back to very slow toy implementation.
verbose 0 (3369: multi_polynomial_ideal.py, groebner_basis) Warning: falling back to very slow toy implementation.
(True, (-t - 2*i : -2*i : 1))
sage: K.<t> = QQ[] ## line 149 ##
sage: C = Conic([4, -4, 8, 1, -4, t + 4]) ## line 150 ##
sage: C.has_rational_point(point=True) ## line 151 ##
(True, (1/2 : 1 : 0))
sage: K.<t> = QQ[] ## line 156 ##
sage: C = Conic(K, [t^2, (t-1), -2*(t-1)]) ## line 157 ##
sage: C.has_rational_point() ## line 158 ##
False
sage: C.has_rational_point(point=True) ## line 160 ##
(False, None)
sage: F.<t1> = FractionField(QQ['t1']) ## line 167 ##
sage: K.<t2> = FractionField(F['t2']) ## line 168 ##
sage: a = K(1) ## line 169 ##
sage: b = 2*t2^2+2*t1*t2-t1^2 ## line 170 ##
sage: c = -3*t2^4-4*t1*t2^3+8*t1^2*t2^2+16*t1^3-t2-48*t1^4 ## line 171 ##
sage: C = Conic([a,b,c]) ## line 172 ##
sage: C.has_rational_point() ## line 173 ##
verbose 0 (3369: multi_polynomial_ideal.py, groebner_basis) Warning: falling back to very slow toy implementation.
verbose 0 (3369: multi_polynomial_ideal.py, groebner_basis) Warning: falling back to very slow toy implementation.
verbose 0 (3369: multi_polynomial_ideal.py, groebner_basis) Warning: falling back to very slow toy implementation.
verbose 0 (3369: multi_polynomial_ideal.py, groebner_basis) Warning: falling back to very slow toy implementation.
verbose 0 (3369: multi_polynomial_ideal.py, groebner_basis) Warning: falling back to very slow toy implementation.
verbose 0 (3369: multi_polynomial_ideal.py, groebner_basis) Warning: falling back to very slow toy implementation.
sage: P.<u> = QQ[] ## line 186 ##
sage: E = P.fraction_field() ## line 187 ##
sage: Q.<Y> = E[] ## line 188 ##
sage: F.<v> = E.extension(Y^2 - u^3 - 1) ## line 189 ##
sage: R.<t> = F[] ## line 190 ##
sage: K = R.fraction_field() ## line 191 ##
sage: C = Conic(K, [u, v, 1]) ## line 192 ##
sage: C.has_rational_point() ## line 193 ##
verbose 0 (3369: multi_polynomial_ideal.py, groebner_basis) Warning: falling back to very slow toy implementation.
verbose 0 (3369: multi_polynomial_ideal.py, groebner_basis) Warning: falling back to very slow toy implementation.
verbose 0 (3369: multi_polynomial_ideal.py, groebner_basis) Warning: falling back to very slow toy implementation.
verbose 0 (3369: multi_polynomial_ideal.py, groebner_basis) Warning: falling back to very slow toy implementation.
verbose 0 (3369: multi_polynomial_ideal.py, groebner_basis) Warning: falling back to very slow toy implementation.
verbose 0 (3369: multi_polynomial_ideal.py, groebner_basis) Warning: falling back to very slow toy implementation.
sage: K.<t> = PolynomialRing(GF(7)) ## line 205 ##
sage: C = Conic([5*t^2+4, t^2+3*t+3, 6*t^2+3*t+2, 5*t^2+5, 4*t+3, 4*t^2+t+5]) ## line 206 ##
sage: C.has_rational_point() ## line 207 ##
sage: K.<t> = FractionField(PolynomialRing(QQ, 't')) ## line 224 ##
sage: a = (2*t^2 - 3/2*t + 1)/(37/3*t^2 + t - 1/4) ## line 225 ##
sage: b = (1/2*t^2 + 1/3)/(-73*t^2 - 2*t + 11/4) ## line 226 ##
sage: c = (6934/3*t^6 + 8798/3*t^5 - 947/18*t^4 + 3949/9*t^3 + 20983/18*t^2 + 28/3*t - 131/3)/(-2701/3*t^4 - 293/3*t^3 + 301/6*t^2 + 13/4*t - 11/16) ## line 227 ##
sage: C = Conic([a,b,c]) ## line 228 ##
sage: C.has_rational_point(point=True) ## line 229 ##
(True, (4*t + 4 : 2*t + 2 : 1))
sage: K.<t> = FractionField(PolynomialRing(QQ, 't')) ## line 234 ##
sage: a = (-1/3*t^6 - 14*t^5 - 1/4*t^4 + 7/2*t^2 - 1/2*t - 1)/(24/5*t^6 - t^5 - 1/4*t^4 + t^3 - 3*t^2 + 8/5*t + 5) ## line 235 ##
sage: b = (-3*t^3 + 8*t + 1/2)/(-1/3*t^3 + 3/2*t^2 + 1/12*t + 1/2) ## line 236 ##
sage: c = (1232009/225*t^25 - 1015925057/8100*t^24 + 1035477411553/1458000*t^23 + 7901338091/30375*t^22 - 1421379260447/729000*t^21 + 266121260843/972000*t^20 + 80808723191/486000*t^19 - 516656082523/972000*t^18 + 21521589529/40500*t^17 + 4654758997/21600*t^16 - 20064038625227/9720000*t^15 - 173054270347/324000*t^14 + 536200870559/540000*t^13 - 12710739349/50625*t^12 - 197968226971/135000*t^11 - 134122025657/810000*t^10 + 22685316301/120000*t^9 - 2230847689/21600*t^8 - 70624099679/270000*t^7 - 4298763061/270000*t^6 - 41239/216000*t^5 - 13523/36000*t^4 + 493/36000*t^3 + 83/2400*t^2 + 1/300*t + 1/200)/(-27378/125*t^17 + 504387/500*t^16 - 97911/2000*t^15 + 1023531/4000*t^14 + 1874841/8000*t^13 + 865381/12000*t^12 + 15287/375*t^11 + 6039821/6000*t^10 + 599437/1500*t^9 + 18659/250*t^8 + 1218059/6000*t^7 + 2025127/3000*t^6 + 1222759/6000*t^5 + 38573/200*t^4 + 8323/125*t^3 + 15453/125*t^2 + 17031/500*t + 441/10) ## line 237 ##
sage: C = Conic([a,b,c]) ## line 238 ##
sage: C.has_rational_point(point = True) # long time (4 seconds) ## line 239 ##

**********************************************************************

Excluding unrelated failures in src/sage/dev/, the following tests failed (still in 7.2) with Singular built with GCC 6.1.0 and -fno-delete-null-pointer-checks:

----------------------------------------------------------------------
...
sage -t --long src/sage/doctest/forker.py  # 1 doctest failed
sage -t --long src/sage/libs/singular/standard_options.py  # 2 doctests failed
sage -t --long src/sage/matrix/matrix_double_dense.pyx  # 1 doctest failed
sage -t --long src/sage/libs/gap/assigned_names.py  # 1 doctest failed
sage -t --long src/sage/rings/invariant_theory.py  # 13 doctests failed
sage -t --long src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py  # 2 doctests failed
sage -t --long src/sage/rings/ideal.py  # 1 doctest failed
sage -t --long src/sage/rings/polynomial/multi_polynomial_ideal.py  # 2 doctests failed
sage -t --long src/sage/rings/polynomial/multi_polynomial_ideal_libsingular.pyx  # 1 doctest failed
sage -t --long src/sage/schemes/elliptic_curves/ell_field.py  # 1 doctest failed
sage -t --long src/sage/schemes/elliptic_curves/ell_generic.py  # 1 doctest failed
sage -t --long src/sage/schemes/elliptic_curves/ell_curve_isogeny.py  # 1 doctest failed
sage -t --long src/sage/schemes/elliptic_curves/isogeny_small_degree.py  # 15 doctests failed
sage -t --long src/sage/schemes/elliptic_curves/jacobian.py  # 1 doctest failed
sage -t --long src/sage/tests/french_book/mpoly.py  # 1 doctest failed
sage -t --long src/sage/schemes/plane_conics/con_rational_function_field.py  # Timed out (and interrupt failed)
----------------------------------------------------------------------

The GAP failure is unrelated (but typical here, passes when rerun), while the forker doctest failure is indeed indirectly caused by Singular (or libsingular), also fails when rerun:

sage -t --long src/sage/doctest/forker.py
**********************************************************************
File "src/sage/doctest/forker.py", line 1402, in sage.doctest.forker.DocTestDispatcher.serial_dispatch
Failed example:
    DD.serial_dispatch()
Expected:
    sage -t .../rings/homset.py
        [... tests, ... s]
    sage -t .../rings/ideal.py
        [... tests, ... s]
Got:
    sage -t /data/Sage/release/stable/sage-7.2-gcc-6.1.0/src/sage/rings/homset.py
        [46 tests, 0.12 s]
    sage -t /data/Sage/release/stable/sage-7.2-gcc-6.1.0/src/sage/rings/ideal.py
    **********************************************************************
    File "/data/Sage/release/stable/sage-7.2-gcc-6.1.0/src/sage/rings/ideal.py", line 1611, in sage.rings.ideal.Cyclic
    Failed example:
        len(B)
    Expected:
        45
    Got:
        1
    **********************************************************************
    1 item had failures:
       1 of   9 in sage.rings.ideal.Cyclic
        [351 tests, 1 failure, 52.37 s]
**********************************************************************
1 item had failures:
   1 of  17 in sage.doctest.forker.DocTestDispatcher.serial_dispatch
    [439 tests, 1 failure, 63.08 s]
----------------------------------------------------------------------
sage -t --long src/sage/doctest/forker.py  # 1 doctest failed
----------------------------------------------------------------------

comment:13 follow-up: Changed 3 years ago by leif

All of the above Singular-related failures vanish when building Singular with -O1 -fno-delete-null-pointer-checks, so there's more optimization options we apparently have to disable with GCC 6.1.0.

comment:14 Changed 3 years ago by vbraun

  • Branch changed from u/aapitzsch/gcc6issue to 04c0af9477f794f5d00a1c813725049d340bf4bd
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:15 in reply to: ↑ 13 Changed 3 years ago by leif

  • Commit 04c0af9477f794f5d00a1c813725049d340bf4bd deleted

Replying to leif:

All of the above Singular-related failures vanish when building Singular with -O1 -fno-delete-null-pointer-checks, so there's more optimization options we apparently have to disable with GCC 6.1.0.

With env CXXFLAGS="-fno-strict-overflow -fno-delete-null-pointer-checks" ./sage -f singular all Singular-related doctests again pass in make ptestlong.

Note: See TracTickets for help on using tickets.