[Bug c/95002] VLA: 'var = sizeof array' gives spurous '= array, ' instead of just '= '

2020-05-11 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95002 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #5

[Bug c/95002] VLA: 'var = sizeof array' gives spurous '= array, ' instead of just '= '

2020-05-11 Thread burnus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95002 --- Comment #3 from Tobias Burnus --- As discussed with Joseph on IRC: * The 'array, 4*len' is one on purpose per C spec (sizeof for an expression with VLA type is defined to evaluate its argument.) * g++ might not do this, if so, it is a bug.

[Bug c/95002] VLA: 'var = sizeof array' gives spurous '= array, ' instead of just '= '

2020-05-11 Thread burnus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95002 --- Comment #4 from Tobias Burnus --- (In reply to Tobias Burnus from comment #3) > * Convert should do the folding and leave the fold to gimple folding Which means that one has to do this kind of folding before handling the share/map handling f

[Bug c/95002] VLA: 'var = sizeof array' gives spurous '= array, ' instead of just '= '

2020-05-11 Thread burnus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95002 --- Comment #2 from Tobias Burnus --- The "array," is added by c_expr_sizeof_expr: if (c_vla_type_p (TREE_TYPE (folded_expr))) { /* sizeof is evaluated when given a vla (C99 6.5.3.4p2). */ ret.value = build2 (C

[Bug c/95002] VLA: 'var = sizeof array' gives spurous '= array, ' instead of just '= '

2020-05-08 Thread burnus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95002 --- Comment #1 from Tobias Burnus --- Created attachment 48481 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48481&action=edit PATCH – works but is modifies quite a lot: digest_init, convert_for_assignment, convert Working patch – but I w