On 04/10/2016 07:14 PM, Martin Sebor wrote:
The call to build_vla_check() in check_initializer() is to check only explicitly initialized VLAs. The latter function may need to complete the VLA element type and reshape the initializer so the call cannot be made earlier. The function returns the runtime initializer code so the call cannot be made after it returns.
But this call isn't checking the initializer; we're looking at the initializer in build_vec_init now.
The call to build_vla_check() in cp_finish_decl() is guarded with !init and made to check VLAs that are not explicitly initialized. This call could perhaps be moved into check_initializer() though it doesn't seem like it logically belongs there (since there is no initializer).
check_initializer handles implicit (default-) as well as explicit initialization.
If it were moved there, it seems to me that it would require more extensive changes to the function than making it in cp_finish_decl().
I don't see that; you ought to be able to move the check_initializer copy down out of the if/else structure and use that for both cases.
+/* Build an expression to determine whether the VLA TYPE is erroneous. + INIT is the VLA initializer expression or NULL_TREE when the VLA is + not initialized. */ + +/* Build an expression to determine whether the VLA TYPE is erroneous. + INIT is the VLA initializer expression or NULL_TREE when the VLA is + not initialized. */
Duplicate comment. Jason