clang 6.0.1

Bugs

Modérateur : xcasadmin

frederic han
Messages : 1110
Inscription : dim. mai 20, 2007 7:09 am
Localisation : Paris
Contact :

clang 6.0.1

Message par frederic han » jeu. oct. 25, 2018 11:53 am

Hi bernard,
on this topic,

https://trac.sagemath.org/ticket/26315#comment:14

dimpase suggest the following patch to build giac with clang 6.0.1


https://trac.sagemath.org/raw-attachmen ... g601.patch

could you tell us if you plan to include it in giac?
Best
Frederic

parisse
Messages : 5055
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: clang 6.0.1

Message par parisse » jeu. oct. 25, 2018 2:40 pm

Ok, I have patched with unsigned() and int(). Does this really stop compilation or is it a warning? Because I don't like to change int to unsigned, this is dangerous (seems safe here).

frederic han
Messages : 1110
Inscription : dim. mai 20, 2007 7:09 am
Localisation : Paris
Contact :

Re: clang 6.0.1

Message par frederic han » dim. oct. 28, 2018 1:07 pm

Thank you,
Yes they were errors. NB dimpase also mention that register gives a warning that will become an error in C++17

cf: https://trac.sagemath.org/ticket/26315#comment:19

dimpase
Messages : 15
Inscription : mer. oct. 24, 2018 9:58 am

Re: clang 6.0.1

Message par dimpase » mar. oct. 30, 2018 11:28 am

One further small patch for clang 6.0.1 I need to make giac build is discussed here https://trac.sagemath.org/ticket/26315#comment:21

It's just

Code : Tout sélectionner

--- a/src/misc.h
+++ b/src/misc.h
@@ -23,6 +23,7 @@
 #include "gen.h"
 #include "unary.h"
 #include "symbolic.h"
+#include <sys/time.h>
 
 #ifndef NO_NAMESPACE_GIAC
 namespace giac {
 
With this and the previous one in this thread, I can build on FreeBSD 12.0 - which hopefully will allow me to re-enable the port of giac on this system.

parisse
Messages : 5055
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: clang 6.0.1

Message par parisse » mer. oct. 31, 2018 4:13 pm

Ok, I'm adding

Code : Tout sélectionner

#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif

dimpase
Messages : 15
Inscription : mer. oct. 24, 2018 9:58 am

Re: clang 6.0.1

Message par dimpase » jeu. nov. 01, 2018 11:22 pm

parisse a écrit :
jeu. oct. 25, 2018 2:40 pm
Ok, I have patched with unsigned() and int(). Does this really stop compilation or is it a warning? Because I don't like to change int to unsigned, this is dangerous (seems safe here).
I tried this with 1.5.0-11 (with the extra sys/time.h patch, as it's not in this version yet), and I still have one error:

solve.cc:5811:49: error: non-constant-expression cannot be narrowed from type 'unsigned int' to 'unsigned char' in initializer list [-Wc++11-narrowing]
order_t order_={static_cast<short>(order),unsigned(lexvars)};
^~~~~~~~~~~~~~~~~
solve.cc:5811:49: note: insert an explicit cast to silence this issue
order_t order_={static_cast<short>(order),unsigned(lexvars)};
^~~~~~~~~~~~~~~~~
static_cast<unsigned char>( )

parisse
Messages : 5055
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: clang 6.0.1

Message par parisse » ven. nov. 02, 2018 2:12 pm

Perhaps

Code : Tout sélectionner

      order_t order_={static_cast<short>(order),unsigned(lexvars/256),unsigned(lexvars)};

dimpase
Messages : 15
Inscription : mer. oct. 24, 2018 9:58 am

Re: clang 6.0.1

Message par dimpase » dim. nov. 18, 2018 12:15 am

This still gives

Code : Tout sélectionner

solve.cc:5812:49: error: non-constant-expression cannot be narrowed from type 'unsigned int' to 'unsigned char' in
      initializer list [-Wc++11-narrowing]
      order_t order_={static_cast<short>(order),unsigned(lexvars/256),unsigned(lexvars)};
                                                ^~~~~~~~~~~~~~~~~~~~~
solve.cc:5812:49: note: insert an explicit cast to silence this issue
      order_t order_={static_cast<short>(order),unsigned(lexvars/256),unsigned(lexvars)};
                                                ^~~~~~~~~~~~~~~~~~~~~
                                                static_cast<unsigned char>( )
solve.cc:5812:71: error: non-constant-expression cannot be narrowed from type 'unsigned int' to 'unsigned char' in
      initializer list [-Wc++11-narrowing]
      order_t order_={static_cast<short>(order),unsigned(lexvars/256),unsigned(lexvars)};
                                                                      ^~~~~~~~~~~~~~~~~
solve.cc:5812:71: note: insert an explicit cast to silence this issue
      order_t order_={static_cast<short>(order),unsigned(lexvars/256),unsigned(lexvars)};
                                                                      ^~~~~~~~~~~~~~~~~
                                                                      static_cast<unsigned char>( )

dimpase
Messages : 15
Inscription : mer. oct. 24, 2018 9:58 am

Re: clang 6.0.1

Message par dimpase » dim. nov. 18, 2018 12:26 am

Build succeeds if I do what the compiler says, i.e. write

Code : Tout sélectionner

order_t order_={static_cast<short>(order),
                static_cast<unsigned char>(unsigned(lexvars/256)),
                static_cast<unsigned char>(unsigned(lexvars))};

parisse
Messages : 5055
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: clang 6.0.1

Message par parisse » dim. nov. 18, 2018 7:14 am

Ok, I changed unsigned to unsigned char. There is certainly a flag to avoid this warning, converting an unsigned (or an int) to an unsigned char is quite common...

dimpase
Messages : 15
Inscription : mer. oct. 24, 2018 9:58 am

Re: clang 6.0.1

Message par dimpase » mar. nov. 20, 2018 11:22 am

It's not a warning, it's an error. Probably, conforming to a recent C++1x standard, I don't know.

dimpase
Messages : 15
Inscription : mer. oct. 24, 2018 9:58 am

Re: clang 6.0.1

Message par dimpase » mer. nov. 21, 2018 1:49 pm

the unstable tarball (dated 18/11/18) builds OK with clang 6.0.1, thanks!

I noticed that hevea is a requirement for a successful install, but there is no dedicated configure option to disable it.
Is it intentional, or one can still somehow use configure to disable hevea?

parisse
Messages : 5055
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: clang 6.0.1

Message par parisse » mer. nov. 21, 2018 2:36 pm

It should be possible to build without hevea. Since I have it installed I don't know if something fails without.
hevea is anyway a very good addition, because if you have it installed, you can write latex files with giac commands, compile them with hevea2mml and display as HTML+MathML with input fields where the giac commands can be modified and executed from a browser.

dimpase
Messages : 15
Inscription : mer. oct. 24, 2018 9:58 am

Re: clang 6.0.1

Message par dimpase » mer. nov. 21, 2018 2:45 pm

No, without hevea it errors out, and with hevea (installed as a FreeBSD package) I get the following error:

Code : Tout sélectionner

gmake[3]: Entering directory '/usr/home/dimpase/Sage/sagemath/local/var/tmp/sage/build/giac-1.5.0-11/src/doc/el'
gmake[3]: warning: -jN forced in submake: disabling jobserver mode.
gmake[4]: Entering directory '/usr/home/dimpase/Sage/sagemath/local/var/tmp/sage/build/giac-1.5.0-11/src/doc/el'
gmake[4]: warning: -jN forced in submake: disabling jobserver mode.
gmake[4]: Nothing to be done for 'install-exec-am'.
TEXINPUTS=.:$TEXINPUTS  cas_el.tex
/bin/sh: cas_el.tex: not found
gmake[4]: *** [Makefile:1029: cas_el.dvi] Error 127

dimpase
Messages : 15
Inscription : mer. oct. 24, 2018 9:58 am

Re: clang 6.0.1

Message par dimpase » mer. nov. 21, 2018 4:26 pm

there is something fishy with doc/el. Namely, if I remove el from the list of languages, i.e. apply

Code : Tout sélectionner

--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -336,8 +336,8 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-SUBDIRS = en es fr el local pt zh de
-DIST_SUBDIRS = en es fr el local pt zh de
+SUBDIRS = en es fr local pt zh de
+DIST_SUBDIRS = en es fr local pt zh de
 XCASHTML = xcasfr.html xcasen.html *.css *.js giacwasm.wasm logo.png giac.tex giacfr.tex test.tex testfr.tex test.html testfr.html algolycee.html graphtheory-user_manual.pdf *.sty
 EXTRA_DIST = aide_cas README index.html $(XCASHTML) dxcas/* pari/* castex.tex tortue.tex 
 dist_pkgdata_DATA = aide_cas
 
then the build works.

Répondre