Open eli-schwartz opened 8 months ago
Did the above patch address the issue?
>>> Preparing source in /var/tmp/portage/dev-db/slony1-2.2.10-r1/work/slony1-2.2.10 ...
* ================================================================================================================================================================================================================
* Applying user patches from /etc/portage/patches ...
* Applying 22.patch ... [ ok ]
* User patches applied.
* ================================================================================================================================================================================================================
[...]
x86_64-pc-linux-gnu-gcc -march=native -fstack-protector-all -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-clash-protection -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wformat -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Werror=int-conversion -Werror=incompatible-pointer-types -Wall -Wmissing-prototypes -Wmissing-declarations -fno-common -I/usr/include/postgresql-14/ -c -o test-scanner.o test-scanner.c
x86_64-pc-linux-gnu-gcc -march=native -fstack-protector-all -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-clash-protection -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wformat -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Werror=int-conversion -Werror=incompatible-pointer-types -Wall -Wmissing-prototypes -Wmissing-declarations -fno-common -I/usr/include/postgresql-14/ -c -o scanner.o scanner.c
test-scanner.c: In function ‘main’:
test-scanner.c:18:9: warning: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
18 | fread(foo, sizeof(char), 65536, stdin);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
x86_64-pc-linux-gnu-gcc -I/usr/include/postgresql-14/ -march=native -fstack-protector-all -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-clash-protection -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wformat -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Werror=int-conversion -Werror=incompatible-pointer-types -Wall -Wmissing-prototypes -Wmissing-declarations -fno-common -Wl,-O1 -Wl,--as-needed -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wl,--defsym=__gentoo_check_ldflags__=0 -L/usr/lib64/postgresql-14/lib64/ -lpq -Wl,-rpath,/usr/lib64/postgresql-14/lib64/ -o test-scanner test-scanner.c scanner.o
test-scanner.c: In function ‘main’:
test-scanner.c:18:9: warning: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
18 | fread(foo, sizeof(char), 65536, stdin);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./test-scanner < /dev/null > emptytestresult.log
./test-scanner < ./test_sql.sql > test_sql.log
./test-scanner < ./cstylecomments.sql > cstylecomments.log
make[2]: Leaving directory '/var/tmp/portage/dev-db/slony1-2.2.10-r1/work/slony1-2.2.10-14/src/parsestatements'
Looks good to me, thanks for the quick fix.
I tried to build with the following *FLAGS to optimize the build:
-flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing
Note the -Werror=* flags are used to help detect cases where the compiler tries to optimize by assuming UB cannot exist in the source code -- if it does exist, ordinarily the code would be miscompiled, and this says to make the miscompilation a fatal error.
I got this error:
Downstream report: https://bugs.gentoo.org/855251 Full build log: build.log