Message ID | 20220921135108.3324737-5-adhemerval.zanella@linaro.org |
---|---|
State | New |
Headers | show |
Series | Fix -Os build | expand |
On Wed, Sep 21, 2022 at 10:51:06AM -0300, Adhemerval Zanella via Libc-alpha wrote: > GCC with -Os warns that the mq_send input may be used uninitialized. > Although for the tests the data content sent is not important, since > both tests checks only if mq_notify was properly set, the warning is > correct and data is indeed uninitialized. LGTM. No regressions on x86_64. Pre-commit CI didn't run for these patches. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com> > Checked on x86_64-linux-gnu and i686-linux-gnu. > --- > rt/tst-mqueue5.c | 2 +- > rt/tst-mqueue6.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/rt/tst-mqueue5.c b/rt/tst-mqueue5.c > index 70d97a36c2..2b19b6a031 100644 > --- a/rt/tst-mqueue5.c > +++ b/rt/tst-mqueue5.c > @@ -58,7 +58,7 @@ rtmin_handler (int sig, siginfo_t *info, void *ctx) > static int > (mqsend) (mqd_t q, int line) > { > - char c; > + char c = 0; OK. Agreed. Data needs to be initialized. > if (mq_send (q, &c, 1, 1) != 0) > { > printf ("mq_send on line %d failed with: %m\n", line); > diff --git a/rt/tst-mqueue6.c b/rt/tst-mqueue6.c > index bc875f101e..a22ac05aca 100644 > --- a/rt/tst-mqueue6.c > +++ b/rt/tst-mqueue6.c > @@ -40,7 +40,7 @@ > static int > (mqsend) (mqd_t q, int line) > { > - char c; > + char c = 0; OK. Agreed. Data needs to be initialized. > if (mq_send (q, &c, 1, 1) != 0) > { > printf ("mq_send on line %d failed with: %m\n", line); > -- > 2.34.1 >
diff --git a/rt/tst-mqueue5.c b/rt/tst-mqueue5.c index 70d97a36c2..2b19b6a031 100644 --- a/rt/tst-mqueue5.c +++ b/rt/tst-mqueue5.c @@ -58,7 +58,7 @@ rtmin_handler (int sig, siginfo_t *info, void *ctx) static int (mqsend) (mqd_t q, int line) { - char c; + char c = 0; if (mq_send (q, &c, 1, 1) != 0) { printf ("mq_send on line %d failed with: %m\n", line); diff --git a/rt/tst-mqueue6.c b/rt/tst-mqueue6.c index bc875f101e..a22ac05aca 100644 --- a/rt/tst-mqueue6.c +++ b/rt/tst-mqueue6.c @@ -40,7 +40,7 @@ static int (mqsend) (mqd_t q, int line) { - char c; + char c = 0; if (mq_send (q, &c, 1, 1) != 0) { printf ("mq_send on line %d failed with: %m\n", line);