https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78081
Bug ID: 78081 Summary: -Wmaybe-initialized false-alarm regression for Emacs regex.c Product: gcc Version: 6.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: eggert at gnu dot org Target Milestone: --- Created attachment 39869 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39869&action=edit test program illustrating -Wmaybe-uninitialized false alarm I found this when compiling a test version of GNU Emacs with gcc (GCC) 6.2.1 20160916 (Red Hat 6.2.1-2) on x86-64. The problem does not occur with gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4) on x86-64 so this appears to be a regression. The problem caused the Emacs build to fail when configured with --enable-gcc-warnings, when compiling src/regex.c. I reduced the problem case to a relatively small source file u2.i (attached). Compile it with the command: gcc -S -Werror=maybe-uninitialized -O2 u2.i GCC will complain as follows and then fail: u2.i: In function 're_search_2': u2.i:59:42: error: 'offset2' may be used uninitialized in this function [-Werro\ r=maybe-uninitialized] if (string2) string2 = offset2 + new_base; ~~~~~~~~^~~~~~~~~~ This diagnostic is incorrect, as offset2 must be initialized, using the same reasoning that offset1 must be initialized (which GCC gets right).