[all-commits] [llvm/llvm-project] d1a632: [C2y] Fix _Countof handling of VLAs (#141621)

Aaron Ballman via All-commits all-commits at lists.llvm.org
Tue May 27 11:59:51 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d1a6327b2b5d859c992599ac217aaa6d8b83a998
      https://github.com/llvm/llvm-project/commit/d1a6327b2b5d859c992599ac217aaa6d8b83a998
  Author: Aaron Ballman <aaron at aaronballman.com>
  Date:   2025-05-27 (Tue, 27 May 2025)

  Changed paths:
    M clang/lib/CodeGen/CGExprScalar.cpp
    M clang/test/C/C2y/n3369_3.c

  Log Message:
  -----------
  [C2y] Fix _Countof handling of VLAs (#141621)

It turns out that getVLASize() does not get you the size of a single
dimension of the VLA, it gets you the full count of all elements. This
caused _Countof to return invalid values on VLA ranks. Now switched to
using getVLAElements1D() instead, which only gets a single dimension.

Fixes #141409



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list