[Bug c++/103984] [12 regression] Possible maybe-uninitialized false positive on shaderc-2021.0 since r12-6329

jason at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jan 26 19:03:25 GMT 2022


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

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Jason Merrill from comment #5)
> It is surprising that we warn with a user-provided copy constructor and
> don't with a defaulted constructor.  It changes the code a bit because it
> means string_piece isn't trivially copyable, so we need to create a
> string_piece temporary for passing to to_stage instead of passing arg
> directly by bitwise copy, but I don't know why that would confuse the
> optimizers into thinking that _M_p might be uninitialized.

The diff of the GIMPLE is

@@ -40,10 +39,7 @@
                 D$ = 1;
                 try
                   {
-                    string_piece::string_piece (&D$, &arg);
-                    try
-                      {
-                        _2 = to_stage (&D$);
+                        _2 = to_stage (arg);
                         D$.stage = _2;
                         D$ = 0;
                         try
@@ -62,11 +58,6 @@
                             D$ = {CLOBBER};
                           }
                       }
-                    finally
-                      {
-                        D$ = {CLOBBER};
-                      }
-                  }
                 catch
                   {
                     if (D$ != 0) goto <D$>; else goto <D$>;


More information about the Gcc-bugs mailing list