discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Michal Nowak <mnowak@startmail.com>
To: discuss@mandoc.bsd.lv
Subject: error: 'XXX' may be used uninitialized in this function
Date: Mon, 3 Jun 2019 17:28:28 +0200	[thread overview]
Message-ID: <5a8f2439-c566-c9e2-f796-86dccbd697f9@startmail.com> (raw)

Hello,

I work on updating mandoc to 1.14.5 on illumos and there are few errors 
(warnings treated as errors) when building mandoc with GCC 4.4.4 and 7.4.0:

+ /opt/gcc/4.4.4/bin/gcc -fident -finline -fno-inline-functions 
-fno-builtin -fno-asm -fdiagnostics-show-option -nodefaultlibs -D__sun 
-O -m32 -Wall -Wextra -Werror -Wno-missing-braces -Wno-sign-compare 
-Wno-unknown-pragmas -Wno-unused-parameter 
-Wno-missing-field-initializers -Wno-array-bounds -std=gnu99 
-fno-inline-small-functions -fno-inline-functions-called-once 
-fno-ipa-cp -D_TS_ERRNO -DOSNAME="illumos" -D_FILE_OFFSET_BITS=64 
-nostdinc -I. -include fts.h -I/usr/include -c -o mdoc_term.o 
/export/home/newman/ws/oi-userland/components/openindiana/illumos-gate/illumos-gate/usr/src/cmd/mandoc/mdoc_term.c
cc1: warnings being treated as errors
/export/home/newman/ws/oi-userland/components/openindiana/illumos-gate/illumos-gate/usr/src/cmd/mandoc/mdoc_term.c: 
In function 'print_mdoc_node':
/export/home/newman/ws/oi-userland/components/openindiana/illumos-gate/illumos-gate/usr/src/cmd/mandoc/mdoc_term.c:310: 
error: 'act' may be used uninitialized in this function [-Wuninitialized]

+ /usr/gcc/7/bin/gcc -fident -finline -fno-inline-functions -fno-builtin 
-fno-asm -fdiagnostics-show-option -nodefaultlibs -D__sun -O -m32 -Wall 
-Wextra -Werror -Wno-missing-braces -Wno-sign-compare 
-Wno-unknown-pragmas -Wno-unused-parameter 
-Wno-missing-field-initializers -Wno-array-bounds -std=gnu99 
-fno-inline-small-functions -fno-inline-functions-called-once 
-fno-ipa-cp -fno-ipa-icf -fno-clone-functions -fno-reorder-functions 
-D_TS_ERRNO -DOSNAME="illumos" -D_FILE_OFFSET_BITS=64 -nostdinc -I. 
-include fts.h -I/usr/include -c -o 
/tmp/nightly.tmpdir.3713/cw.YdaGE4/cwYdaWE4.o 
/export/home/newman/ws/oi-userland/components/openindiana/illumos-gate/illumos-gate/usr/src/cmd/mandoc/mdoc_term.c
/export/home/newman/ws/oi-userland/components/openindiana/illumos-gate/illumos-gate/usr/src/cmd/mandoc/mdoc_term.c: 
In function 'print_mdoc_node':
/export/home/newman/ws/oi-userland/components/openindiana/illumos-gate/illumos-gate/usr/src/cmd/mandoc/mdoc_term.c:418:10: 
error: 'act' may be used uninitialized in this function 
[-Werror=maybe-uninitialized]
    if (act->post == NULL || n->flags & NODE_ENDED)
        ~~~^~~~~~
cc1: all warnings being treated as errors
*** Error code 1

+ /opt/gcc/4.4.4/bin/gcc -fident -finline -fno-inline-functions 
-fno-builtin -fno-asm -fdiagnostics-show-option -nodefaultlibs -D__sun 
-O -m32 -Wall -Wextra -Werror -Wno-missing-braces -Wno-sign-compare 
-Wno-unknown-pragmas -Wno-unused-parameter 
-Wno-missing-field-initializers -Wno-array-bounds -std=gnu99 
-fno-inline-small-functions -fno-inline-functions-called-once 
-fno-ipa-cp -D_TS_ERRNO -DOSNAME="illumos" -D_FILE_OFFSET_BITS=64 
-nostdinc -I. -include fts.h -I/usr/include -c -o read.o 
/export/home/newman/ws/oi-userland/components/openindiana/illumos-gate/illumos-gate/usr/src/cmd/mandoc/read.c
cc1: warnings being treated as errors
/export/home/newman/ws/oi-userland/components/openindiana/illumos-gate/illumos-gate/usr/src/cmd/mandoc/read.c: 
In function 'mparse_buf_r':
/export/home/newman/ws/oi-userland/components/openindiana/illumos-gate/illumos-gate/usr/src/cmd/mandoc/read.c:147: 
error: 'lastln' may be used uninitialized in this function [-Wuninitialized]

+ /opt/gcc/4.4.4/bin/gcc -fident -finline -fno-inline-functions 
-fno-builtin -fno-asm -fdiagnostics-show-option -nodefaultlibs -D__sun 
-O -m32 -Wall -Wextra -Werror -Wno-missing-braces -Wno-sign-compare 
-Wno-unknown-pragmas -Wno-unused-parameter 
-Wno-missing-field-initializers -Wno-array-bounds -std=gnu99 
-fno-inline-small-functions -fno-inline-functions-called-once 
-fno-ipa-cp -D_TS_ERRNO -DOSNAME="illumos" -D_FILE_OFFSET_BITS=64 
-nostdinc -I. -include fts.h -I/usr/include -c -o term.o 
/export/home/newman/ws/oi-userland/components/openindiana/illumos-gate/illumos-gate/usr/src/cmd/mandoc/term.c
cc1: warnings being treated as errors
/export/home/newman/ws/oi-userland/components/openindiana/illumos-gate/illumos-gate/usr/src/cmd/mandoc/term.c: 
In function 'term_fill':
/export/home/newman/ws/oi-userland/components/openindiana/illumos-gate/illumos-gate/usr/src/cmd/mandoc/term.c:258: 
error: 'vn' may be used uninitialized in this function [-Wuninitialized]

+ /usr/gcc/7/bin/gcc -fident -finline -fno-inline-functions -fno-builtin 
-fno-asm -fdiagnostics-show-option -nodefaultlibs -D__sun -O -m32 -Wall 
-Wextra -Werror -Wno-missing-braces -Wno-sign-compare 
-Wno-unknown-pragmas -Wno-unused-parameter 
-Wno-missing-field-initializers -Wno-array-bounds -std=gnu99 
-fno-inline-small-functions -fno-inline-functions-called-once 
-fno-ipa-cp -fno-ipa-icf -fno-clone-functions -fno-reorder-functions 
-D_TS_ERRNO -DOSNAME="illumos" -D_FILE_OFFSET_BITS=64 -nostdinc -I. 
-include fts.h -I/usr/include -c -o 
/tmp/nightly.tmpdir.3713/cw.QPaOX4/cwRPa4X4.o 
/export/home/newman/ws/oi-userland/components/openindiana/illumos-gate/illumos-gate/usr/src/cmd/mandoc/term.c
/export/home/newman/ws/oi-userland/components/openindiana/illumos-gate/illumos-gate/usr/src/cmd/mandoc/term.c: 
In function 'term_fill':
/export/home/newman/ws/oi-userland/components/openindiana/illumos-gate/illumos-gate/usr/src/cmd/mandoc/term.c:286:24: 
error: 'vn' may be used uninitialized in this function 
[-Werror=maybe-uninitialized]
     if (breakline || vn > vtarget)
                      ~~~^~~~~~~~~
cc1: all warnings being treated as errors
*** Error code 1


In all cases I was able to eliminate those errors by initializing 
respective variables to NULL. It seems that none of those errors were 
addressed after the 1.14.5 release.

Michal
--
 To unsubscribe send an email to discuss+unsubscribe@mandoc.bsd.lv

             reply	other threads:[~2019-06-03 15:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-03 15:28 Michal Nowak [this message]
2019-06-03 20:37 ` Ingo Schwarze
2019-06-04  4:53   ` Michal Nowak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5a8f2439-c566-c9e2-f796-86dccbd697f9@startmail.com \
    --to=mnowak@startmail.com \
    --cc=discuss@mandoc.bsd.lv \
    --subject='Re: error: '\''XXX'\'' may be used uninitialized in this function' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).