diff mbox series

c++: Fix offsetof use [PR 98232]

Message ID 939d2a5a-5342-b625-e129-c643b7efb582@acm.org
State New
Headers show
Series c++: Fix offsetof use [PR 98232] | expand

Commit Message

Nathan Sidwell Dec. 16, 2020, 5:46 p.m. UTC
offsetof is underspecified.  GCC happened to accept an unneeded
explicit scoping, clang does not.

	gcc/cp/
         * module.cc (dumper::push): Clangify offsetof use.

pushed
diff mbox series

Patch

diff --git i/gcc/cp/module.cc w/gcc/cp/module.cc
index d2806966e43..e9ea18636b4 100644
--- i/gcc/cp/module.cc
+++ w/gcc/cp/module.cc
@@ -4153,7 +4153,7 @@  dumper::push (module_state *m)
       /* Create or extend the dump implementor.  */
       unsigned current = dumps ? dumps->stack.length () : 0;
       unsigned count = current ? current * 2 : EXPERIMENT (1, 20);
-      size_t alloc = (offsetof (impl, impl::stack)
+      size_t alloc = (offsetof (impl, stack)
 		      + impl::stack_t::embedded_size (count));
       dumps = XRESIZEVAR (impl, dumps, alloc);
       dumps->stack.embedded_init (count, current);