Actions
Bug #633
open
SH
clang builds of v1.7.0 fail: time_start used uninitialized
Bug #633:
clang builds of v1.7.0 fail: time_start used uninitialized
Start date:
03/02/2026
Due date:
% Done:
0%
Estimated time:
Affected versions:
Needs backport to:
Affected hardware:
Affected OS:
Description
recent clang -Wall includes -Wsometimes-uninitialized, which triggers on time_start in cli_classic.c. since flashrom uses -Werror by default, this results in build failure.
FAILED: flashrom.p/cli_classic.c.o
cc -Iflashrom.p -I. -I../flashrom-v1.7.0 -I../flashrom-v1.7.0/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c99 -Wshadow -Wmissing-prototypes -Wwrite-strings -Wno-unused-parameter -Wno-address-of-packed-member -Wno-enum-conversion -Wno-missing-braces -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L -D_BSD_SOURCE -D__BSD_VISIBLE -D__XSI_VISIBLE -D_NETBSD_SOURCE -D_DARWIN_C_SOURCE '-DFLASHROM_VERSION="v1.7.0"' -DHAVE_CLOCK_GETTIME=1 -DHAVE_STRNLEN=1 -DHAVE_GETOPT_H=1 -DHAVE_UTSNAME=1 -DIS_WINDOWS=0 -DCONFIG_USE_LIBPCI_ECAM=0 -DCONFIG_RPMC_ENABLED=1 -D__FLASHROM_LITTLE_ENDIAN__=1 -O2 -pipe -DCONFIG_DELAY_MINIMUM_SLEEP_US=100 -DCONFIG_ASM106X=1 -DCONFIG_ATAVIA=1 -DCONFIG_BUSPIRATE_SPI=1 -DCONFIG_CH341A_SPI=1 -DCONFIG_CH347_SPI=1 -DCONFIG_DEDIPROG=1 -DCONFIG_DEVELOPERBOX_SPI=1 -DCONFIG_DIGILENT_SPI=1 -DCONFIG_DIRTYJTAG_SPI=1 -DCONFIG_DRKAISER=1 -DCONFIG_DUMMY=1 -DCONFIG_FT2232_SPI=1 -DCONFIG_GFXNVIDIA=1 -DCONFIG_INTERNAL=1 -DCONFIG_INTERNAL_DMI=1 -DCONFIG_IT8212=1 -DCONFIG_NIC3COM=1 -DCONFIG_NICINTEL=1 -DCONFIG_NICINTEL_EEPROM=1 -DCONFIG_NICINTEL_SPI=1 -DCONFIG_NICREALTEK=1 -DCONFIG_NV_SMA_SPI=1 -DCONFIG_OGP_SPI=1 -DCONFIG_PICKIT2_SPI=1 -DCONFIG_PONY_SPI=1 -DCONFIG_RAIDEN_DEBUG_SPI=1 -DCONFIG_RAYER_SPI=1 -DCONFIG_SATAMV=1 -DCONFIG_SATASII=1 -DCONFIG_SERPROG=1 -DCONFIG_SPIDRIVER=1 -DCONFIG_STLINKV3_SPI=1 -DCONFIG_USBBLASTER_SPI=1 -DCONFIG_DEFAULT_PROGRAMMER_NAME=NULL '-DCONFIG_DEFAULT_PROGRAMMER_ARGS=""' -DLOG_MESSAGE_LENGTH_LIMIT=256 -MD -MQ flashrom.p/cli_classic.c.o -MF flashrom.p/cli_classic.c.o.d -o flashrom.p/cli_classic.c.o -c ../flashrom-v1.7.0/cli_classic.c
../flashrom-v1.7.0/cli_classic.c:1188:6: error: variable 'time_start' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
1188 | if (options.prog == NULL) {
| ^~~~~~~~~~~~~~~~~~~~
../flashrom-v1.7.0/cli_classic.c:1592:28: note: uninitialized use occurs here
1592 | (int)(difftime(time_end, time_start) / 60), (int)(difftime(time_end, time_start)) % 60);
| ^~~~~~~~~~
../flashrom-v1.7.0/include/flash.h:746:49: note: expanded from macro 'msg_gdbg'
746 | #define msg_gdbg(...) print(FLASHROM_MSG_DEBUG, __VA_ARGS__) /* general debug */
| ^~~~~~~~~~~
../flashrom-v1.7.0/cli_classic.c:1188:2: note: remove the 'if' if its condition is always false
1188 | if (options.prog == NULL) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
1189 | const struct programmer_entry *const default_programmer = CONFIG_DEFAULT_PROGRAMMER_NAME;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1190 |
1191 | if (default_programmer) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~
1192 | options.prog = default_programmer;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1193 | /* We need to strdup here because we free(pparam) unconditionally later. */
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1194 | options.pparam = strdup(CONFIG_DEFAULT_PROGRAMMER_ARGS);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1195 | msg_pinfo("Using default programmer \"%s\" with arguments \"%s\".\n",
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1196 | default_programmer->name, options.pparam);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1197 | } else {
| ~~~~~~~~
1198 | msg_perr("Please select a programmer with the --programmer parameter.\n"
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1199 | #if CONFIG_INTERNAL == 1
| ~~~~~~~~~~~~~~~~~~~~~~~~
1200 | "To choose the mainboard of this computer use 'internal'. "
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1201 | #endif
| ~~~~~~
1202 | "Valid choices are:\n");
| ~~~~~~~~~~~~~~~~~~~~~~~~
1203 | list_programmers_linebreak(0, 80, 0);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../flashrom-v1.7.0/cli_classic.c:1179:7: error: variable 'time_start' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
1179 | if (!chip || !chip->name) {
| ^~~~~~~~~~~~~~~~~~~~
../flashrom-v1.7.0/cli_classic.c:1592:28: note: uninitialized use occurs here
1592 | (int)(difftime(time_end, time_start) / 60), (int)(difftime(time_end, time_start)) % 60);
| ^~~~~~~~~~
../flashrom-v1.7.0/include/flash.h:746:49: note: expanded from macro 'msg_gdbg'
746 | #define msg_gdbg(...) print(FLASHROM_MSG_DEBUG, __VA_ARGS__) /* general debug */
| ^~~~~~~~~~~
../flashrom-v1.7.0/cli_classic.c:1179:3: note: remove the 'if' if its condition is always false
1179 | if (!chip || !chip->name) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
1180 | msg_cerr("Error: Unknown chip '%s' specified.\n", options.chip_to_probe);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1181 | msg_gerr("Run flashrom -L to view the hardware supported in this flashrom version.\n");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1182 | ret = 1;
| ~~~~~~~~
1183 | goto out;
| ~~~~~~~~~
1184 | }
| ~
../flashrom-v1.7.0/cli_classic.c:1179:7: error: variable 'time_start' is used uninitialized whenever '||' condition is true [-Werror,-Wsometimes-uninitialized]
1179 | if (!chip || !chip->name) {
| ^~~~~
../flashrom-v1.7.0/cli_classic.c:1592:28: note: uninitialized use occurs here
1592 | (int)(difftime(time_end, time_start) / 60), (int)(difftime(time_end, time_start)) % 60);
| ^~~~~~~~~~
../flashrom-v1.7.0/include/flash.h:746:49: note: expanded from macro 'msg_gdbg'
746 | #define msg_gdbg(...) print(FLASHROM_MSG_DEBUG, __VA_ARGS__) /* general debug */
| ^~~~~~~~~~~
../flashrom-v1.7.0/cli_classic.c:1179:7: note: remove the '||' if its condition is always false
1179 | if (!chip || !chip->name) {
| ^~~~~~~~
../flashrom-v1.7.0/cli_classic.c:1170:6: error: variable 'time_start' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
1170 | if (!options.ifd && !options.fmap && process_include_args(options.layout, options.include_args)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../flashrom-v1.7.0/cli_classic.c:1592:28: note: uninitialized use occurs here
1592 | (int)(difftime(time_end, time_start) / 60), (int)(difftime(time_end, time_start)) % 60);
| ^~~~~~~~~~
../flashrom-v1.7.0/include/flash.h:746:49: note: expanded from macro 'msg_gdbg'
746 | #define msg_gdbg(...) print(FLASHROM_MSG_DEBUG, __VA_ARGS__) /* general debug */
| ^~~~~~~~~~~
../flashrom-v1.7.0/cli_classic.c:1170:2: note: remove the 'if' if its condition is always false
1170 | if (!options.ifd && !options.fmap && process_include_args(options.layout, options.include_args)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1171 | ret = 1;
| ~~~~~~~~
1172 | goto out;
| ~~~~~~~~~
1173 | }
| ~
../flashrom-v1.7.0/cli_classic.c:1165:6: error: variable 'time_start' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
1165 | if (options.layoutfile && layout_from_file(&options.layout, options.layoutfile)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../flashrom-v1.7.0/cli_classic.c:1592:28: note: uninitialized use occurs here
1592 | (int)(difftime(time_end, time_start) / 60), (int)(difftime(time_end, time_start)) % 60);
| ^~~~~~~~~~
../flashrom-v1.7.0/include/flash.h:746:49: note: expanded from macro 'msg_gdbg'
746 | #define msg_gdbg(...) print(FLASHROM_MSG_DEBUG, __VA_ARGS__) /* general debug */
| ^~~~~~~~~~~
../flashrom-v1.7.0/cli_classic.c:1165:2: note: remove the 'if' if its condition is always false
1165 | if (options.layoutfile && layout_from_file(&options.layout, options.layoutfile)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1166 | ret = 1;
| ~~~~~~~~
1167 | goto out;
| ~~~~~~~~~
1168 | }
| ~
../flashrom-v1.7.0/cli_classic.c:1150:6: error: variable 'time_start' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
1150 | if (options.list_supported) {
| ^~~~~~~~~~~~~~~~~~~~~~
../flashrom-v1.7.0/cli_classic.c:1592:28: note: uninitialized use occurs here
1592 | (int)(difftime(time_end, time_start) / 60), (int)(difftime(time_end, time_start)) % 60);
| ^~~~~~~~~~
../flashrom-v1.7.0/include/flash.h:746:49: note: expanded from macro 'msg_gdbg'
746 | #define msg_gdbg(...) print(FLASHROM_MSG_DEBUG, __VA_ARGS__) /* general debug */
| ^~~~~~~~~~~
../flashrom-v1.7.0/cli_classic.c:1150:2: note: remove the 'if' if its condition is always false
1150 | if (options.list_supported) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1151 | if (print_supported())
| ~~~~~~~~~~~~~~~~~~~~~~
1152 | ret = 1;
| ~~~~~~~~
1153 | goto out;
| ~~~~~~~~~
1154 | }
| ~
../flashrom-v1.7.0/cli_classic.c:1058:19: note: initialize the variable 'time_start' to silence this warning
1058 | time_t time_start, time_end;
| ^
| = 0
6 errors generated.
Files
Actions