Thread: gcc-14.1.0 [-Werror=array-bounds=] meson buildtype=release compile error
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, meson buildtype=release works fine. gcc-14.1.0 meson buildtype=debug works fines but the $SUBJECT error occurred. my system: ubuntu1~22.04 [1409/1982] Compiling C object src/pl/plpgsql/src/plpgsql.so.p/pl_exec.c.o FAILED: src/pl/plpgsql/src/plpgsql.so.p/pl_exec.c.o /usr/local/gcc-14.1.0/bin/gcc-14.1.0 -Isrc/pl/plpgsql/src/plpgsql.so.p -Isrc/pl/plpgsql/src -I../../Desktop/pg_src/src8/postgres/src/pl/plpgsql/src -Isrc/include -I../../Desktop/pg_src/src8/postgres/src/include -I/usr/include/libxml2 -fdiagnostics-color=always --coverage -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -O3 -g -fno-strict-aliasing -fwrapv -fexcess-precision=standard -D_GNU_SOURCE -Wmissing-prototypes -Wpointer-arith -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -Wdeclaration-after-statement -Wmissing-variable-declarations -Wno-format-truncation -Wno-stringop-truncation -Wunused-variable -Wuninitialized -Werror=maybe-uninitialized -Wreturn-type -DWRITE_READ_PARSE_PLAN_TREES -DCOPY_PARSE_PLAN_TREES -DREALLOCATE_BITMAPSETS -DLOCK_DEBUG -DENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS -DRAW_EXPRESSION_COVERAGE_TEST -fno-omit-frame-pointer -fPIC -pthread -fvisibility=hidden -MD -MQ src/pl/plpgsql/src/plpgsql.so.p/pl_exec.c.o -MF src/pl/plpgsql/src/plpgsql.so.p/pl_exec.c.o.d -o src/pl/plpgsql/src/plpgsql.so.p/pl_exec.c.o -c ../../Desktop/pg_src/src8/postgres/src/pl/plpgsql/src/pl_exec.c In file included from ../../Desktop/pg_src/src8/postgres/src/include/access/htup_details.h:22, from ../../Desktop/pg_src/src8/postgres/src/pl/plpgsql/src/pl_exec.c:21: In function ‘assign_simple_var’, inlined from ‘exec_set_found’ at ../../Desktop/pg_src/src8/postgres/src/pl/plpgsql/src/pl_exec.c:8384:2: ../../Desktop/pg_src/src8/postgres/src/include/varatt.h:230:36: error: array subscript 0 is outside array bounds of ‘char[0]’ [-Werror=array-bounds=] 230 | (((varattrib_1b_e *) (PTR))->va_tag) | ^ ../../Desktop/pg_src/src8/postgres/src/include/varatt.h:94:12: note: in definition of macro ‘VARTAG_IS_EXPANDED’ 94 | (((tag) & ~1) == VARTAG_EXPANDED_RO) | ^~~ ../../Desktop/pg_src/src8/postgres/src/include/varatt.h:284:57: note: in expansion of macro ‘VARTAG_1B_E’ 284 | #define VARTAG_EXTERNAL(PTR) VARTAG_1B_E(PTR) | ^~~~~~~~~~~ ../../Desktop/pg_src/src8/postgres/src/include/varatt.h:301:57: note: in expansion of macro ‘VARTAG_EXTERNAL’ 301 | (VARATT_IS_EXTERNAL(PTR) && !VARTAG_IS_EXPANDED(VARTAG_EXTERNAL(PTR))) | ^~~~~~~~~~~~~~~ ../../Desktop/pg_src/src8/postgres/src/pl/plpgsql/src/pl_exec.c:8572:17: note: in expansion of macro ‘VARATT_IS_EXTERNAL_NON_EXPANDED’ 8572 | VARATT_IS_EXTERNAL_NON_EXPANDED(DatumGetPointer(newvalue))) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In function ‘exec_set_found’: cc1: note: source object is likely at address zero cc1: all warnings being treated as errors [1419/1982] Compiling C object src/bin/pg_dump/pg_dump.p/pg_dump.c.o
Re: gcc-14.1.0 [-Werror=array-bounds=] meson buildtype=release compile error
From
David Rowley
Date:
On Fri, 11 Oct 2024 at 22:19, jian he <jian.universality@gmail.com> wrote: > array subscript 0 is outside array bounds of ‘char[0]’ > [-Werror=array-bounds=] > 230 | (((varattrib_1b_e *) (PTR))->va_tag) > | ^ Please read the thread at https://postgr.es/m/flat/CAFj8pRBJD_Y-XcqwXSbWS24z%2B84FFX7ajhCan9ixc_m4bD63sA%40mail.gmail.com David