Bug 35199 - [PATCH] Check for valid value of BASEVER
Summary: [PATCH] Check for valid value of BASEVER
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 4.2.3
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: build, internal-improvement, patch
: 35197 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-02-14 18:59 UTC by Daniel Richard G.
Modified: 2024-08-03 18:40 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Patch against gcc/Makefile.in (287 bytes, patch)
2008-02-14 19:01 UTC, Daniel Richard G.
Details | Diff
Updated patch against gcc/Makefile.in (291 bytes, patch)
2008-02-15 18:41 UTC, Daniel Richard G.
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Richard G. 2008-02-14 18:59:33 UTC
I was recently bootstrapping GCC4 on Tru64. One thing that tripped me up a couple times was an ICE resulting from an invalid version_string (""). I traced this back to the following fragment in gcc/Makefile, where BASEVER_c is assigned:

    BASEVER     := $(srcdir)/BASE-VER  # 4.x.y
    [...]
    BASEVER_c   := $(shell cat $(BASEVER))

For some reason, the value of BASEVER_c was empty. I had the source tree on NFS, and figured that some transient error caused $(BASEVER) to either disappear momentarily, or briefly appear as an empty file. (It's difficult to say, because the rest of the build proceeded with no errors of this sort whatsoever.)

Whatever the cause, the makefile as currently written does not check for an empty value of BASEVER_c, and the ICE that later results from this is magnitudes of order more difficult to diagnose for most users. I would like to submit a patch to the makefile, then, that immediately throws an error if BASEVER_c is empty.
Comment 1 Daniel Richard G. 2008-02-14 19:01:00 UTC
Created attachment 15151 [details]
Patch against gcc/Makefile.in
Comment 2 Andrew Pinski 2008-02-14 19:33:58 UTC
BASE-VER should always exist.

Also patches should be posted to gcc-patches@.
Comment 3 Daniel Richard G. 2008-02-15 18:41:04 UTC
Created attachment 15157 [details]
Updated patch against gcc/Makefile.in

Mail sent to gcc-patches@. Today I'm building GCC again, and lo and behold, the BASEVER_c check tripped:

----begin----
rm -f libdecnumber.a
ar cru libdecnumber.a decNumber.o decContext.o decUtility.o decimal32.o decimal64.o decimal128.o
ranlib libdecnumber.a
gmake[3]: Leaving directory `/mnt/scratch/build/35197/gcc--4.2.3.build/libdecnumber'
gmake[3]: Entering directory `/mnt/scratch/build/35197/gcc--4.2.3.build/gcc'
Makefile:739: *** /tg/freeport/src/gcc/gcc--4.2.3/gcc/BASE-VER  : missing version file.  Stop.
gmake[3]: Leaving directory `/mnt/scratch/build/35197/gcc--4.2.3.build/gcc'
gmake[2]: *** [all-stage1-gcc] Error 2
gmake[2]: Leaving directory `/mnt/scratch/build/35197/gcc--4.2.3.build'
gmake[1]: *** [stage1-bubble] Error 2
gmake[1]: Leaving directory `/mnt/scratch/build/35197/gcc--4.2.3.build'
gmake: *** [bootstrap-lean] Error 2
----end----

Sure beats an ICE! Anyway, I don't see any error from cat(1), so it looks like BASE-VER is being read as an empty file. (If I cat the file manually, it comes up non-empty; the problem is very transient.)

Patch tweaked slightly to remove spurious whitespace from the error message.
Comment 4 Daniel Richard G. 2008-02-16 18:42:46 UTC
*** Bug 35197 has been marked as a duplicate of this bug. ***
Comment 5 Sam James 2024-08-02 02:43:03 UTC
(In reply to Daniel Richard G. from comment #3)
> Created attachment 15157 [details]
> Updated patch against gcc/Makefile.in
> 
> Mail sent to gcc-patches@. Today I'm building GCC again, and lo and behold,
> the BASEVER_c check tripped:
> [...]

https://inbox.sourceware.org/gcc-patches/20080214195846.GA3085@iSKUNK.ORG/