public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107351] New: Bootstrap fails when gcc is built with gcc-13-master: error: conversion from 'long unsigned int' to 'unsigned int' changes value from '7001010000' to '2706042704'
@ 2022-10-21 18:24 slyfox at gcc dot gnu.org
  2022-10-21 18:38 ` [Bug c++/107351] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: slyfox at gcc dot gnu.org @ 2022-10-21 18:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107351

            Bug ID: 107351
           Summary: Bootstrap fails when gcc is built with gcc-13-master:
                    error: conversion from 'long unsigned int' to
                    'unsigned int' changes value from '7001010000' to
                    '2706042704'
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

When building gcc-13-master with gcc-13-master I see the following bootstrap
failure:

../../source/gcc/cp/module.cc: In member function 'void
module_state::write_readme(elf_out*, cpp_reader*, const char*)':
<command-line>: error: conversion from 'long unsigned int' to 'unsigned int'
changes value from '7001010000' to '2706042704' [-Werror=overflow]
../../source/gcc/cp/module.cc:14170:19: note: in expansion of macro
'MODULE_VERSION'
14170 |   version2string (MODULE_VERSION, string);
      |                   ^~~~~~~~~~~~~~

I understand bootstrap with unreleased gcc is not very well supported. But in
this case it sounds like a natural fix. Worth switching to `uint64_t` to store
gcc version internally?

configure flags: --prefix=/<<NIX>>/gcc-13.0.0
--with-gmp-include=/<<NIX>>/gmp-with-cxx-6.2.1-dev/include
--with-gmp-lib=/<<NIX>>/gmp-with-cxx-6.2.1/lib
--with-mpfr-include=/<<NIX>>/mpfr-4.1.0-dev/include
--with-mpfr-lib=/<<NIX>>/mpfr-4.1.0/lib --with-mpc=/<<NIX>>/libmpc-1.2.1
--with-native-system-header-dir=/<<NIX>>/glibc-2.35-163-dev/include
--with-build-sysroot=/ --program-prefix= --enable-lto --disable-libstdcxx-pch
--without-included-gettext --with-system-zlib --enable-checking=release
--enable-static --enable-languages=c\,c++ --disable-multilib --enable-plugin
--with-isl=/<<NIX>>/isl-0.20 --build=x86_64-unknown-linux-gnu
--host=x86_64-unknown-linux-gnu --target=x86_64-unknown-linux-gnu

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

* [Bug c++/107351] Bootstrap fails when gcc is built with gcc-13-master: error: conversion from 'long unsigned int' to 'unsigned int' changes value from '7001010000' to '2706042704'
  2022-10-21 18:24 [Bug c++/107351] New: Bootstrap fails when gcc is built with gcc-13-master: error: conversion from 'long unsigned int' to 'unsigned int' changes value from '7001010000' to '2706042704' slyfox at gcc dot gnu.org
@ 2022-10-21 18:38 ` pinskia at gcc dot gnu.org
  2022-10-21 18:50 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-21 18:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107351

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-10-21
             Status|UNCONFIRMED                 |WAITING
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
# In non-release builds, use a date-related module version.
ifneq ($(DEVPHASE_c),)
# Some date's don't grok 'r', if so, simply use today's
# date (don't bootstrap at midnight).
MODULE_VERSION := $(shell date -r $(srcdir)/cp/module.cc '+%y%m%d-%H%M' \
  2>/dev/null || date '+%y%m%d-0000' 2>/dev/null || echo 0)

CFLAGS-cp/module.o += -DMODULE_VERSION='($(subst -,,$(MODULE_VERSION))U)'
endif


I am trying to figure out how you would get 7001010000 if the above was being
used.
Can you attach the full build log around the building of module.cc ?

it should have been -DMODULE_VERSION=2210211757U or something similar.

Even in the source we have:
#define IS_EXPERIMENTAL(V) ((V) >= (1U << 20))
#define MODULE_MAJOR(V) ((V) / 10000)
#define MODULE_MINOR(V) ((V) % 10000)
#define EXPERIMENT(A,B) (IS_EXPERIMENTAL (MODULE_VERSION) ? (A) : (B))
#ifndef MODULE_VERSION
#include "bversion.h"
#define MODULE_VERSION (BUILDING_GCC_MAJOR * 10000U + BUILDING_GCC_MINOR)
#elif !IS_EXPERIMENTAL (MODULE_VERSION)
#error "This is not the version I was looking for."
#endif

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

* [Bug c++/107351] Bootstrap fails when gcc is built with gcc-13-master: error: conversion from 'long unsigned int' to 'unsigned int' changes value from '7001010000' to '2706042704'
  2022-10-21 18:24 [Bug c++/107351] New: Bootstrap fails when gcc is built with gcc-13-master: error: conversion from 'long unsigned int' to 'unsigned int' changes value from '7001010000' to '2706042704' slyfox at gcc dot gnu.org
  2022-10-21 18:38 ` [Bug c++/107351] " pinskia at gcc dot gnu.org
@ 2022-10-21 18:50 ` jakub at gcc dot gnu.org
  2022-10-21 19:53 ` slyfox at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-10-21 18:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107351

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Perhaps if the filesystem doesn't have timestamps or the file has for whatever
reason the Unix era timestamp (1970-01-01 00:00)?
The version fits into unsigned int only if it is in between 2000 and 2042
inclusive.

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

* [Bug c++/107351] Bootstrap fails when gcc is built with gcc-13-master: error: conversion from 'long unsigned int' to 'unsigned int' changes value from '7001010000' to '2706042704'
  2022-10-21 18:24 [Bug c++/107351] New: Bootstrap fails when gcc is built with gcc-13-master: error: conversion from 'long unsigned int' to 'unsigned int' changes value from '7001010000' to '2706042704' slyfox at gcc dot gnu.org
  2022-10-21 18:38 ` [Bug c++/107351] " pinskia at gcc dot gnu.org
  2022-10-21 18:50 ` jakub at gcc dot gnu.org
@ 2022-10-21 19:53 ` slyfox at gcc dot gnu.org
  2022-10-21 19:59 ` slyfox at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: slyfox at gcc dot gnu.org @ 2022-10-21 19:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107351

--- Comment #3 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
Created attachment 53750
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53750&action=edit
gcc-13.0.0-build.log.xz

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

* [Bug c++/107351] Bootstrap fails when gcc is built with gcc-13-master: error: conversion from 'long unsigned int' to 'unsigned int' changes value from '7001010000' to '2706042704'
  2022-10-21 18:24 [Bug c++/107351] New: Bootstrap fails when gcc is built with gcc-13-master: error: conversion from 'long unsigned int' to 'unsigned int' changes value from '7001010000' to '2706042704' slyfox at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-10-21 19:53 ` slyfox at gcc dot gnu.org
@ 2022-10-21 19:59 ` slyfox at gcc dot gnu.org
  2022-10-21 20:07 ` pinskia at gcc dot gnu.org
  2022-10-21 20:33 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: slyfox at gcc dot gnu.org @ 2022-10-21 19:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107351

--- Comment #4 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
Attached the build log.

I completely forgot about the fact that I was using gcc source from
"normalized" filesystem which intentionally resets all timestamps (it's one of
the build modes for my distribution to validate build determinism):

$ LANG=C ls -l
/nix/store/p2m8xz3klafr1ydbjf8g86vmylziscr3-source/gcc/cp/module.cc
-r--r--r-- 4 root root 533735 Jan  1  1970
/nix/store/p2m8xz3klafr1ydbjf8g86vmylziscr3-source/gcc/cp/module.cc

Silly question: would it be reasonable for module.cc to use
gcc/{BASE-VER,DATESTAMP}?

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

* [Bug c++/107351] Bootstrap fails when gcc is built with gcc-13-master: error: conversion from 'long unsigned int' to 'unsigned int' changes value from '7001010000' to '2706042704'
  2022-10-21 18:24 [Bug c++/107351] New: Bootstrap fails when gcc is built with gcc-13-master: error: conversion from 'long unsigned int' to 'unsigned int' changes value from '7001010000' to '2706042704' slyfox at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-10-21 19:59 ` slyfox at gcc dot gnu.org
@ 2022-10-21 20:07 ` pinskia at gcc dot gnu.org
  2022-10-21 20:33 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-21 20:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107351

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
-DMODULE_VERSION='(7001010000U)'

Hmm.
The date command is not listed in the build log either (debugging make here is
going to be "hard").

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

* [Bug c++/107351] Bootstrap fails when gcc is built with gcc-13-master: error: conversion from 'long unsigned int' to 'unsigned int' changes value from '7001010000' to '2706042704'
  2022-10-21 18:24 [Bug c++/107351] New: Bootstrap fails when gcc is built with gcc-13-master: error: conversion from 'long unsigned int' to 'unsigned int' changes value from '7001010000' to '2706042704' slyfox at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-10-21 20:07 ` pinskia at gcc dot gnu.org
@ 2022-10-21 20:33 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-21 20:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107351

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Sergei Trofimovich from comment #4)
> Attached the build log.
> 
> I completely forgot about the fact that I was using gcc source from
> "normalized" filesystem which intentionally resets all timestamps (it's one
> of the build modes for my distribution to validate build determinism):
> 
> $ LANG=C ls -l
> /nix/store/p2m8xz3klafr1ydbjf8g86vmylziscr3-source/gcc/cp/module.cc
> -r--r--r-- 4 root root 533735 Jan  1  1970
> /nix/store/p2m8xz3klafr1ydbjf8g86vmylziscr3-source/gcc/cp/module.cc
> 
> Silly question: would it be reasonable for module.cc to use
> gcc/{BASE-VER,DATESTAMP}?

The problem with DATESTAMP is that it changes every day while module support
does not. So this might be ok.
You might be one of the few which does the reset timestamp stuff and even then
it seems like it could be broken ...

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

end of thread, other threads:[~2022-10-21 20:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-21 18:24 [Bug c++/107351] New: Bootstrap fails when gcc is built with gcc-13-master: error: conversion from 'long unsigned int' to 'unsigned int' changes value from '7001010000' to '2706042704' slyfox at gcc dot gnu.org
2022-10-21 18:38 ` [Bug c++/107351] " pinskia at gcc dot gnu.org
2022-10-21 18:50 ` jakub at gcc dot gnu.org
2022-10-21 19:53 ` slyfox at gcc dot gnu.org
2022-10-21 19:59 ` slyfox at gcc dot gnu.org
2022-10-21 20:07 ` pinskia at gcc dot gnu.org
2022-10-21 20:33 ` pinskia at gcc dot gnu.org

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