- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I encountered a phenomenon that a statement expression is always evaluated as zero when variable length array is declared inside it. Constant-length array did not cause this problem, including an array whose length is specified by a variable which is qualified as `const`. It reproduced with Intel C Compiler version 13.0.1, 16.0.3, 17.0.0, and 18.0.0 (which were available at https://godbolt.org/ and my environment). It didn't happen with the C++ compiler (icpc). The following is a code that reproduces the situation. Here is a link to the same code at compiler explorer: https://godbolt.org/g/YrNgfb .
#include <stddef.h> int vla_in_statement_expression(void) { size_t len = 5; int a = ({ int vla[len]; 42; }); return(a); }
I would appreciate if the compiler team respond to this problem. I'm sorry if it is not a bug but a correct behavior that is described in the document.
Thanks,
Hajime Suzuki
- Tags:
- CC++
- Development Tools
- Intel® C++ Compiler
- Intel® Parallel Studio XE
- Intel® System Studio
- Optimization
- Parallel Computing
- Vectorization
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for reporting this issue. Let me look into it and get back to you.
Regards,
Viet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've filed a bug report to our developer. The internal tracking is: CMPLRS-50845. I'll let you know when we have a fix.
Thanks,
Viet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks! I really appreciate your quick response.
Hajime
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
the reference (version 19 at least) says that 'Variable-length arrays are no longer allowed in statement expressions.'

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page