unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Warnings when building with LTO
@ 2019-05-09 22:49 Alex Gramiak
  2019-05-10  7:23 ` Paul Eggert
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Gramiak @ 2019-05-09 22:49 UTC (permalink / raw)
  To: emacs-devel

Also, with OpenSUSE looking to enable LTO by default[1], it would be
nice to reevaluate LTO's role in Emacs release builds, at least for
modern compilers.

INSTALL states:

  Link time optimization is not the default as it tends to cause crashes
  and to make Emacs slower.


Is this still true with GCC 9.1? Paul, can you still reproduce the
bug[2] you mentioned in commit 9b4b2e9fc8 with GCC 9.1?


[1] https://hubicka.blogspot.com/2019/05/gcc-9-link-time-and-inter-procedural.html
[2] https://bugzilla.redhat.com/show_bug.cgi?id=1486455


Build warnings when compiling with --enable-link-time-optimization (with
GCC 8.3.0):

  CCLD     emacsclient
emacsclient.c: In function ‘local_sockname.constprop’:
emacsclient.c:1335:9: warning: ‘/emacs’ directive output truncated writing 6 bytes into a region of size 1 [-Wformat-truncation=]
         "/emacs%"PRIuMAX"/%s", uid, server_name);
         ^
emacsclient.c:1335:9: note: using the range [0, 18446744073709551615] for directive argument
emacsclient.c:1335:9: note: assuming directive output of 1 byte
/usr/include/bits/stdio2.h:67:10: note: ‘__builtin___snprintf_chk’ output 9 or more bytes (assuming 10) into a destination of size 1
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,

  CCLD     temacs
ftfont.c: In function ‘ftfont_shape’:
lisp.h:1772:13: warning: potential null pointer dereference [-Wnull-dereference]
   EMACS_INT size = XBOOL_VECTOR (a)->size;
             ^
image.c: In function ‘jpeg_load_body’:
image.c:6937:31: warning: variable ‘specified_data’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]
   Lisp_Object specified_file, specified_data;
                               ^
image.c: In function ‘png_load_body’:
image.c:6160:31: warning: variable ‘specified_data’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]
   Lisp_Object specified_file, specified_data;
                               ^
image.c:6161:9: warning: variable ‘fp’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]
   FILE *fp = NULL;
         ^
regex-emacs.c: In function ‘re_match_2_internal’:
lisp.h:1772:13: warning: potential null pointer dereference [-Wnull-dereference]
   EMACS_INT size = XBOOL_VECTOR (a)->size;
             ^
regex-emacs.c: In function ‘analyze_first’:
lisp.h:1772:13: warning: potential null pointer dereference [-Wnull-dereference]
   EMACS_INT size = XBOOL_VECTOR (a)->size;
             ^
indent.c: In function ‘position_indentation’:
lisp.h:1772:13: warning: potential null pointer dereference [-Wnull-dereference]
   EMACS_INT size = XBOOL_VECTOR (a)->size;
             ^
indent.c: In function ‘Fvertical_motion’:
bignum.c:65:40: warning: ‘lcols’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   return mpz_get_d_rounded (XBIGNUM (n)->value);
                                        ^
indent.c:2094:15: note: ‘lcols’ was declared here
   Lisp_Object lcols;
               ^
keyboard.c: In function ‘read_char’:
keyboard.c:2314:13: warning: ‘jmpcount’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   ptrdiff_t jmpcount;
             ^
bytecode.c: In function ‘exec_byte_code’:
bytecode.c:367:9: warning: variable ‘alloc’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]
   void *alloc;



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

* Re: Warnings when building with LTO
  2019-05-09 22:49 Warnings when building with LTO Alex Gramiak
@ 2019-05-10  7:23 ` Paul Eggert
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggert @ 2019-05-10  7:23 UTC (permalink / raw)
  To: Alex Gramiak; +Cc: emacs-devel

On 5/9/19 3:49 PM, Alex Gramiak wrote:
> INSTALL states:
>
>   Link time optimization is not the default as it tends to cause crashes
>   and to make Emacs slower.
>
>
> Is this still true with GCC 9.1?

Not clear. Nobody's really tried it as far as I know. Few people are
using LTO and to some extent it's a chicken-and-egg problem. See, for
example, this recent LTO problem on macOS:

https://lists.gnu.org/r/emacs-devel/2019-05/msg00077.html

for why I still don't recommend using LTO unless your job is to debug LTO.


> Paul, can you still reproduce the
> bug[2] you mentioned in commit 9b4b2e9fc8 with GCC 9.1?
>
>
> [2] https://bugzilla.redhat.com/show_bug.cgi?id=1486455

No, it's fixed for me now (Fedora 30 x86-64, 9.1.1 20190503 (Red Hat
9.1.1-1), current master).

I assume that all the warnings you mention are bogus, though I haven't
checked this. It would not be wise to attempt to pacify GCC on all
platforms, as it (1) would take a lot of time and (2) would clutter the
code and get in the way of real work. So we tend to pacify GCC only for
recent GCC with default compiler flags. If LTO becomes the default or is
otherwise commonly used we should pacify the warnings you mention; until
then, I wouldn't bother.




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

end of thread, other threads:[~2019-05-10  7:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-09 22:49 Warnings when building with LTO Alex Gramiak
2019-05-10  7:23 ` Paul Eggert

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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