Re: Add compiler option -fstrict-flex-arrays=1

From: David Geier <geidav(dot)pg(at)gmail(dot)com>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Tristan Partin <tristan(at)partin(dot)io>, Greg Burd <greg(at)burd(dot)me>
Subject: Re: Add compiler option -fstrict-flex-arrays=1
Date: 2026-10-20 12:37:23
Message-ID: 9ab252fa-450a-422d-b7c9-b9c0327c2824@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>> If we turned on -fstrict-flex-arrays=3, these would become undefined
>>> behavior and trigger the ubsan sanitizer.
>>
>> The compiler setting can be changed on a per-struct basis via
>>
>> __attribute__((strict_flex_arrays(N)));
>
> This only works with gcc, not clang, so it's not a viable solution.

clang has support for it starting with version 16.0, see [1]. Is that
clang version too recent to require it?

--
David Geier

[1] https://releases.llvm.org/16.0.0/tools/clang/docs/ReleaseNotes.html

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message 2026-10-20 13:12:03 AW: AW: Extract text from XML, pay attention to XML Entities
Previous Message Amit Langote 2026-10-20 12:36:05 Re: [PATCH] Fix segmentation fault caused by reentrancy in RI_Fkey_cascade_del (ri_triggers.c)