-
-
Notifications
You must be signed in to change notification settings - Fork 480
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
sage miscompiles with gcc9 #27676
Comments
Attachment: openblas-0.3.5.p1.log.gz Test suite output of |
Attachment: testlong.log.gz
|
Branch: u/Konrad127123/gcc-9-test2 |
Commit: |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
comment:5
FYI: The branch currently attached to this ticket is to help with testing/investigating. It's not an attempt to fix the bugs. |
Attachment: sr.txt.gz Output of |
Output of |
Attachment: multi_polynomial_sequence.txt.gz Output of |
comment:6
Attachment: pbori.txt.gz With I tried gcc 9.1 (from Gentoo) and got a lot of "Bad exit" in tests from memory overflows. |
comment:7
Have you run any tests on individual packages? I would expect a few things to come from individual packages. |
comment:8
Maybe we can upgrade to the released openblas 0.3.6 on a separate ticket to get that out of the way |
comment:9
This is now 27847 |
comment:10
With #27847 only the following failures remain
|
comment:11
That's less than I have in sage-on-gentoo but I haven't rebuilt everything yet. But there is really a track leading to pbori not sure if it is just the sage interface or brial itself. brial passes its own testsuite with gcc-9.1 that's already something but not necessarilly conclusive that it is all on sage-side. From what Steve Trogdon posted to me
I'd say there is something to fix in Cudd inside brial. |
comment:12
I should have posted this elsewhere. |
comment:13
Brial testsuite passes for me, too (gcc 9.1.1 / Fedora 30) |
comment:14
I think the culprit is in a higher stack frame, presumably std::deque runs out of memory because an invalid size is passed in. In particular, this looks fishy:
|
comment:15
There is quite a fat memory leak, e.g.
eats 5GB. Changing the memory limit, e.g.
changes where the error occurs |
comment:16
Disabling the memlimit lets me complete
but does eat much more memory than before. Doing it with the other tests eats all available memory |
comment:17
Did you try going from -std=gnu++11 to -std=c++11 ? This can be done by --- a/build/pkgs/gcc/spkg-configure.m4
+++ b/build/pkgs/gcc/spkg-configure.m4
@@ -94,7 +94,7 @@ SAGE_SPKG_CONFIGURE([gcc], [
IS_REALLY_GCC=yes
fi
- AX_CXX_COMPILE_STDCXX_11([], optional)
+ AX_CXX_COMPILE_STDCXX_11([noext], optional)
if test $HAVE_CXX11 != 1; then
SAGE_MUST_INSTALL_GCC([your C++ compiler does not support C++11])
fi |
comment:18
as well, our boost (and pbori uses it) is 2.5 y.o. version 1.66, while the current one is 1.70. |
comment:19
Brial's reference counting implementation miscompiles with gcc9, and the branch where the refcount falls back to zero is never executed. Hence the ram usage ballooning. I've opened an upstream bug: |
comment:20
it is insane that this kind of address arithmetic is invalid C, as they imply on the ticket. Where is it said in the standard? |
comment:21
I don't think they imply this is invalid C. But this is fairly rare occurrence and, if I am reading correctly, accounting for it everywhere means some optimisation opportunities are lost. As you'll note, Volker said the example works at I should be able to do a micro release of brial to include that option this week. PR welcome if you feel faster. I may also check if I can safely update the
|
comment:22
OK, if they willingly mis-compile valid code for the sake of optimisation, they should at least print fat warnings about code branches they discard... |
comment:23
Replying to @kiwifb:
Perhaps I misunderstand but my s-o-g |
comment:24
OK, Volker's example works at -O0 may be our real life code is a bit more complicated. Could you compile brial with |
comment:25
Replying to @kiwifb:
I still get the 3 failures,
|
comment:26
Reading more into this, C++11 Standard 5.7.5 says that pointer arithmetic on a pointer that is not pointing into an element of an array is undefined behavior. So in particular the compiler is free to assume that The offending code is
Really we should just change These are inlined headers so you also need to rebuild the sage library.... |
comment:27
Indeed, this succeeds for me:
|
comment:28
OK I thought it was in the C code from Cudd. But this is the C++ interface to Cudd from brial. That code is in
|
comment:29
Since we don't want to change the |
comment:30
If you send a pull request I can make a quick release of brial. |
comment:31
Replying to @vbraun:
OK, rebuilding Sage also with the new CFLAGS does work here. I never thought about the headers. |
comment:32
By the way, perhaps it's time to drop gcc 4. Indeed, 4.9.4 was the last 4.* release, and it happened in 2016. |
comment:33
I am now using the following if gcc-9.1 is present in sage-on-gentoo diff --git a/sage/libs/polybori/decl.pxd b/sage/libs/polybori/decl.pxd
index dd6a3aa..edb7bb7 100644
--- a/sage/libs/polybori/decl.pxd
+++ b/sage/libs/polybori/decl.pxd
@@ -1,5 +1,5 @@
# distutils: language = c++
-# distutils: extra_compile_args = -std=c++11
+# distutils: extra_compile_args = -std=c++11 -fno-delete-null-pointer-checks
from libcpp.string cimport string as std_string
from libcpp.vector cimport vector It is possibly over-broad. |
comment:34
PR at BRiAl/BRiAl#35 |
comment:35
New brial release https://github.com/BRiAl/BRiAl/releases/download/1.2.5/brial-1.2.5.tar.bz2 with the PR included. Do we create a separate ticket for the upgrade? |
comment:36
Please do make a ticket for that! |
comment:37
#27942 is ready for review for brial. |
comment:38
As the Sage-8.8 release milestone is pending, we should delete the sage-8.8 milestone for tickets that are not actively being worked on or that still require significant work to move forward. If you feel that this ticket should be included in the next Sage release at the soonest please set its milestone to the next release milestone (sage-8.9). |
comment:39
I think we pretty much fixed this by opening separate tickets for each separate problems. So now, this meta ticket should be closed. |
Reviewer: Steven Trogdon |
comment:40
I agree. |
gcc-9
is due out in late April/early May 2019. With the currentgcc-9
snapshot,sage
has issues where it miscompiles.There seem to be two sets of issues:
openblas-0.3.5
doesn't compile correctly withgcc-9
. This makes lots of errors occur ifSAGE_CHECK="yes"
(inopenblas
and other packages that depend on it) and makesmake testlong
output lots of errors and eventually just hang. As of writing (2019/04/16), this seems to be fixed in upstream git.Something seems to go wrong with
brial
or something related.make testlong
has errors on the following files:As a minor issue, with
SAGE_CHECK="yes"
,make
doesn't seem to stop after compilingopenblas
, despite many tests failing.Latest
gcc-9
snapshot as of writing: ftp://gcc.gnu.org/pub/gcc/snapshots/9-20190414/gcc-9-20190414.tar.xzCurrent
openblas
upstream as of writing: https://community.dur.ac.uk/konrad.dabrowski/sage/openblas-0.3.5b.tar.gzCC: @kiwifb
Component: packages: standard
Keywords: gcc, openblas, brial
Branch/Commit: u/Konrad127123/gcc-9-test2 @
6a54ee1
Reviewer: Steven Trogdon
Issue created by migration from https://trac.sagemath.org/ticket/27676
The text was updated successfully, but these errors were encountered: