On Tue, 2025-02-04 at 15:03 +0000, JohnyTheCarrot via Gcc-help wrote: > Hi all, > > I have built GCC with BUILD_CONFIG="bootstrap-O1" > with the intention of contributing, hence O1. > I ran across two separate build errors, however. > Online, I have found mentions of others running > into similar errors on O1. > > I have made a local patch to fix both build > errors and have since been able to successfully build GCC. > I was wondering if I did something wrong, perhaps? > Does no-one use O1 to build when working on GCC? What do > contributors' build settings usually look like? > If others did, surely this would have been noticed, no? I never used it and I don't think it's very useful. > Both errors are related to uninitialized variables. > One at https://github.com/gcc-mirror/gcc/blob/master/gcc/config/i386/i386-options.cc#L3085 > and one at https://github.com/gcc-mirror/gcc/blob/master/gcc/tree-tailcall.cc#L472 > > If welcome, I can submit my local patches for review. To me it may be better to just do something like diff --git a/config/bootstrap-O1.mk b/config/bootstrap-O1.mk index 031645a1251..8f47739a04b 100644 --- a/config/bootstrap-O1.mk +++ b/config/bootstrap-O1.mk @@ -1 +1 @@ -BOOT_CFLAGS := -O1 $(filter-out -O%, $(BOOT_CFLAGS)) +BOOT_CFLAGS := -O1 $(filter-out -O%, $(BOOT_CFLAGS)) -Wno-maybe-uninitialized instead of "fixing" the "uninitialized" variables here and there. There are no such warnings at -O2, indicating the variables are never really used uninitialized but at -O1 the optimization is just not enough to prove that. Also unnecessarily "initializing" a variable is bad: in case -O2 regresses to fail to recognize a variable is actually always initialized, we immediately get a bootstrap failure and we notice the regression. But if the variable is unnecessarily initialized, when -O2 regresses we wouldn't notice it. And you always have --disable-werror, generally (i.e. for GCC or other packages) when you alters the optimization level you likely need to use it. -- Xi Ruoyao <xry111@xxxxxxxxxxx> School of Aerospace Science and Technology, Xidian University