c++ - gcc 4.9.2 bug in -Wmissing-field-initializers? -
i have issue in code - can copied 1:1 cpp file in order test behaving:
#include <atomic> typedef struct { char sdatetime [20]; char slogfiledirectory [300]; char slogfilenametemplate [300]; char slogoutput [10][100]; std::atomic<bool> breadytoflush; } logentries; typedef struct { logentries lelogentries [1] {}; } logthreads;
compiling gcc 4.9.2 sles 11 sp2 g++ -std=c++11 gcc-warning-bug.cpp -wall -wextra -c
receive these strange warnings:
gcc-warning-bug.cpp:18:34: warning: missing initializer member ‘logentries::sdatetime’ [-wmissing-field-initializers] logentries lelogentries [1] {}; ^ gcc-warning-bug.cpp:18:34: warning: missing initializer member ‘logentries::slogfiledirectory’ [-wmissing-field-initializers] gcc-warning-bug.cpp:18:34: warning: missing initializer member ‘logentries::slogfilenametemplate’ [-wmissing-field-initializers] gcc-warning-bug.cpp:18:34: warning: missing initializer member ‘logentries::slogoutput’ [-wmissing-field-initializers] gcc-warning-bug.cpp:18:34: warning: missing initializer member ‘logentries::breadytoflush’ [-wmissing-field-initializers]
adding {}
initializer in line
std::atomic<bool> breadytoflush {};
even g++ complaining in 1st warning logentries::sdatetime
warnings gone.
the warning gone when remove std::atomic<bool>
line. code simple; when have g++ 4.9.2 check out - strange.
edit: regardless logentries struct
member add {}
initializer warnings gone.
how can behaving explained? me bug...
ps: consider bug: change array specifier in line 1000:
logentries lelogentries [1000] {};
g++ produce 5'000 warnings! suppose not make sense repeat warning each array value.
update:
the 1st case confirmed gnu bug fixed in gcc 5.0
the ice [internal compiler error] in bug database gnu bug database
it seems bug. playing bit around , after modification compiler message gcc stopped because of internal error.
update: requested code cannot compiled gcc. compiler options: g++ -std=c++11 gcc-warning-bug.cpp -wall -wextra -werror -fno-strict-aliasing -fwrapv -fno-aggressive-loop-optimizations -c
- options there because gnu requests bug report.
#include <atomic> class logentries { public: char sdatetime [20]; std::atomic<bool> breadytoflush; }; class logthreads { public: static logentries lelogentries [10]; }; logentries logthreads::lelogentries [10] {};
compiler fails output:
gcc-warning-bug.cpp:16:43: internal compiler error: in gimplify_init_constructor, @ gimplify.c:4007 .... please submit full bug report, preprocessed source if appropriate. please include complete backtrace bug report. see <http://gcc.gnu.org/bugs.html> instructions.
i prepare sample code , submit developer team. in project member lelogentries
static.
when remove std::atomic
line works --> problem in std::atomic
implementation?
Comments
Post a Comment