public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/107743] New: expmed: extract_bit_field_1: maybe-uninitialized warning
@ 2022-11-18  7:27 aldot at gcc dot gnu.org
  2022-11-18  8:10 ` [Bug middle-end/107743] " rguenth at gcc dot gnu.org
  2022-11-19 18:01 ` aldot at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: aldot at gcc dot gnu.org @ 2022-11-18  7:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107743

            Bug ID: 107743
           Summary: expmed: extract_bit_field_1: maybe-uninitialized
                    warning
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aldot at gcc dot gnu.org
  Target Milestone: ---

current trunk around r13-4134

/scratch/obj.x86_64/gcc-13.mine/./prev-gcc/xg++
-B/scratch/obj.x86_64/gcc-13.mine/./prev-gcc/
-B/opt/x86_64/gcc-13.mine/x86_64-pc-linux-gnu/bin/ -nostdinc++
-B/scratch/obj.x86_64/gcc-13.mine/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs
-B/scratch/obj.x86_64/gcc-13.mine/prev-x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs

-I/scratch/obj.x86_64/gcc-13.mine/prev-x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu

-I/scratch/obj.x86_64/gcc-13.mine/prev-x86_64-pc-linux-gnu/libstdc++-v3/include
 -I/scratch/src/gcc-13.mine/libstdc++-v3/libsupc++
-L/scratch/obj.x86_64/gcc-13.mine/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs
-L/scratch/obj.x86_64/gcc-13.mine/prev-x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs
 -fno-PIE -c   -O2 -g3 -ggdb3 -gdwarf-5 -pipe -fno-checking -gtoggle -DIN_GCC  
  -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall
-Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute
-Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros
-Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -I. -I.
-I../../../src/gcc-13.mine/gcc -I../../../src/gcc-13.mine/gcc/.
-I../../../src/gcc-13.mine/gcc/../include
-I../../../src/gcc-13.mine/gcc/../libcpp/include
-I../../../src/gcc-13.mine/gcc/../libcody 
-I../../../src/gcc-13.mine/gcc/../libdecnumber
-I../../../src/gcc-13.mine/gcc/../libdecnumber/bid -I../libdecnumber
-I../../../src/gcc-13.mine/gcc/../libbacktrace   -o expmed.o -MT expmed.o -MMD
-MP -MF ./.deps/expmed.TPo ../../../src/gcc-13.mine/gcc/expmed.cc

../../../src/gcc-13.mine/gcc/expmed.cc: In function 'rtx_def*
extract_bit_field_1(rtx, poly_uint64, poly_uint64, int, rtx, machine_mode,
machine_mode, bool, bool, rtx_def**)':
../../../src/gcc-13.mine/gcc/expmed.cc:1838:45: warning: '*(unsigned
int*)((char*)&imode + offsetof(scalar_int_mode, scalar_int_mode::m_mode))' may
be used uninitialized [-Wmaybe-uninitialized]
 1838 |       rtx sub = extract_bit_field_as_subreg (mode1, op0, imode,
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
 1839 |                                              bitsize, bitnum);
      |                                              ~~~~~~~~~~~~~~~~
../../../src/gcc-13.mine/gcc/expmed.cc:1798:19: note: '*(unsigned
int*)((char*)&imode + offsetof(scalar_int_mode, scalar_int_mode::m_mode))' was
declared here
 1798 |   scalar_int_mode imode;
      |                   ^~~~~

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug middle-end/107743] expmed: extract_bit_field_1: maybe-uninitialized warning
  2022-11-18  7:27 [Bug middle-end/107743] New: expmed: extract_bit_field_1: maybe-uninitialized warning aldot at gcc dot gnu.org
@ 2022-11-18  8:10 ` rguenth at gcc dot gnu.org
  2022-11-19 18:01 ` aldot at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-11-18  8:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107743

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Is that with release checking?  The code around this is

  /* Extraction of a full MODE1 value can be done with a subreg as long
     as the least significant bit of the value is the least significant
     bit of either OP0 or a word of OP0.  */
  if (!MEM_P (op0) && !reverse && op0_mode.exists (&imode))
    {
      rtx sub = extract_bit_field_as_subreg (mode1, op0, imode,
                                             bitsize, bitnum);
      if (sub)
        return convert_extracted_bit_field (sub, mode, tmode, unsignedp);
    }

where

template<typename T>
template<typename U>
inline bool
opt_mode<T>::exists (U *mode) const
{
  if (m_mode != E_VOIDmode)
    {
      *mode = T (typename mode_traits<T>::from_int (m_mode));
      return true;
    }
  return false;
}

so it's unobvious how 'imode' is uninitialized.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug middle-end/107743] expmed: extract_bit_field_1: maybe-uninitialized warning
  2022-11-18  7:27 [Bug middle-end/107743] New: expmed: extract_bit_field_1: maybe-uninitialized warning aldot at gcc dot gnu.org
  2022-11-18  8:10 ` [Bug middle-end/107743] " rguenth at gcc dot gnu.org
@ 2022-11-19 18:01 ` aldot at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: aldot at gcc dot gnu.org @ 2022-11-19 18:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107743

--- Comment #2 from Bernhard Reutner-Fischer <aldot at gcc dot gnu.org> ---
--disable-werror --enable-checking=yes --enable-debug --enable-multilib
--disable-libstdcxx-pch --enable-bootstrap

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-19 18:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-18  7:27 [Bug middle-end/107743] New: expmed: extract_bit_field_1: maybe-uninitialized warning aldot at gcc dot gnu.org
2022-11-18  8:10 ` [Bug middle-end/107743] " rguenth at gcc dot gnu.org
2022-11-19 18:01 ` aldot at gcc dot gnu.org

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 read-only IMAP folder(s) and NNTP newsgroup(s).