This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/68901] UBSan triggers false -Wpadded warning


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

Ivan Sorokin <vanyacpp at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vanyacpp at gmail dot com

--- Comment #1 from Ivan Sorokin <vanyacpp at gmail dot com> ---
I experienced the same issue on GCC 5.3.0. I made a minimal reprocase for the
issue.

struct mytype
{
    void f()
    {
        value = 42;
    }

    unsigned value;
};

void foo()
{
    mytype().f();
}

$ g++ -Wpadded -fsanitize=undefined 2.cpp
2.cpp: In member function ‘void mytype::f()’:
2.cpp:3:10: warning: padding struct size to alignment boundary [-Wpadded]
     void f()
          ^
2.cpp: In function ‘void foo()’:
2.cpp:11:6: warning: padding struct size to alignment boundary [-Wpadded]
 void foo()
      ^

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]