Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails in branch openocd-cubeide-r4 or tag openocd-cubeide-v1.8.0 or later [-Werror=maybe-uninitialized] #10

Open
etienz opened this issue Sep 6, 2022 · 3 comments
Assignees

Comments

@etienz
Copy link

etienz commented Sep 6, 2022

Build fails in fresh docker build on branch openocd-cubeide-r4 or tag openocd-cubeide-v1.8.0 or later.
Tag openocd-cubeide-v1.7.0 and branch openocd-cubeide-r3 build fine.

Docker commands:

ARG VARIANT="focal"
FROM ubuntu:${VARIANT} AS openocd-builder

ARG OPENOCD_PATH=/opt/openocd-stm

RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
    && apt-get -y install --no-install-recommends \
    build-essential \
    ca-certificates \
    git \
    # build tools for openocd
    libhidapi-dev \
    libusb-1.0-0-dev \
    libusb-dev \
    libtool \ 
    make \
    automake \
    autoconf \
    pkg-config \
    tclsh \
    telnet \
 && rm -rf /var/lib/apt/lists/*

RUN git clone --branch openocd-cubeide-r4 https://github.com/STMicroelectronics/OpenOCD.git ${OPENOCD_PATH} \
 && cd ${OPENOCD_PATH} \
 && ./bootstrap \
 && ./configure --enable-stlink \
 && make -j"$($(nproc) + 2)"

Full error message:

#6 67.64 /bin/bash ./libtool  --tag=CC   --mode=link gcc -Wall -Wstrict-prototypes -Wformat-security -Wshadow -Wextra -Wno-unused-parameter -Wbad-function-cast -Wcast-align -Wredundant-decls -Wpointer-arith -Wundef -Wno-error=deprecated-declarations -Werror -g -O2   -o src/target/openrisc/libopenrisc.la  src/target/openrisc/or1k.lo src/target/openrisc/or1k_du_adv.lo src/target/openrisc/or1k_tap_mohor.lo src/target/openrisc/or1k_tap_vjtag.lo src/target/openrisc/or1k_tap_xilinx_bscan.lo src/target/openrisc/jsp_server.lo  -lutil -ldl
#6 67.71 In file included from ./src/helper/list.h:21,
#6 67.71                  from ./src/helper/binarybuffer.h:25,
#6 67.71                  from src/jtag/drivers/stlink_usb.c:37:
#6 67.71 src/jtag/drivers/stlink_usb.c: In function 'stlink_dap_op_queue_run_internal':
#6 67.71 mv -f src/target/.deps/libtarget_la-armv8_dpm.Tpo src/target/.deps/libtarget_la-armv8_dpm.Plo
#6 67.74 ./src/helper/types.h:194:9: error: 'misc_items' may be used uninitialized in this function [-Werror=maybe-uninitialized]
#6 67.74   194 |  buf[0] = (uint8_t) (val >> 0);
#6 67.74       |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
#6 67.74 src/jtag/drivers/stlink_usb.c:4595:20: note: 'misc_items' was declared here
#6 67.74  4595 |  unsigned int cnt, misc_items;
#6 67.74       |                    ^~~~~~~~~~
@XiaZhouZero
Copy link

I encountered the same issue. I simply initialized the misc_items to 0 and passed the compilation.

@tarek-bochkati tarek-bochkati self-assigned this Nov 2, 2022
@tarek-bochkati
Copy link
Contributor

Thanks @etienz and @XiaZhouZero for reporting this.
It seems that we are building using a difference GCC version that's why we have not encountered the same issue as you.

could you please share with us the GCC version you are using, so we can fix this in the official openocd gerrit

@XiaZhouZero
Copy link

I'm using the GCC 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1) @tarek-bochkati

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants