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++/39803] Bogus 'unused value' warning on declarations of non-POD arrays



------- Comment #1 from lcwu at gcc dot gnu dot org  2009-04-17 23:07 -------
This bogus warning started to show up after the fix for PR c++/39551 was
submitted (at revision 146132). And the root cause for the issue is that C++
front-end generates the following code to initialize the local 'pair' array:
(see build_vec_init() in cp/init.c)

*(struct pair[3] *) ({
  (D.2247 = (struct pair *) &components);
  (D.2248 = D.2247);
  (D.2249 = 2);
  for_stmt
    {
      D.2249 != -1;
      --D.2249;
      __comp_ctor  (NON_LVALUE_EXPR <D.2248>);
      ++D.2248;
    }
  D.2247; })

The INDIRECT_REF operation (*) in the above code was later determined useless
and therefore deleted. However, since we didn't know that the INDIRECT_REF
expression was actually created by the compiler (instead of coming from the
user code) and therefore mistakenly emit an 'unused value' warning.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39803


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