[RFC] glibc AI policy. Round 3. Adopt the GCC AI policy.
Carlos O'Donell
carlos@redhat.com
Tue Nov 3 22:49:26 GMT 2026
On 10/24/26 1:19 PM, Paul Eggert wrote:
> I have some qualms with glibc's using gcc's AI policy as-is for test
> cases. Test cases in GCC and glibc typically have different roles and
> behave differently, and this difference matters for AI policy.
Circling back here with more time to review.
> GCC tests are typically quite distinct from the compiler. If they
> have copyright violations, no big deal: just remove the tests. glibc
> tests, in contrast, often include internal glibc headers or rely
> heavily on glibc internals, with a greater risk of code leaking into
> the test or vice versa. If glibc tests are considered to be
> uncopyrightable because they're LLM-generated, we'll effectively lose
> copyright protections for glibc proper. Although there are techniques
> to mitigate this risk, but I expect too many contributors won't know
> about them or won't bother.
I think the leakage is in one direction only: outward.
While there is leakage from the implementation into the test (internal
headers and implementation details), I don't think there is leakage
from the test into the implementation.
The tests are often radically different from the implementation in terms
of what they need to consider:
* Permutation of options.
* Permutation of valid modes of the API and how to call it.
* Setting up concurrency between multiple threads to test thread APIs.
These things make tests very different from the implementation which is
often either single threaded, or concerned with correct locking for the
implementation of a concurrency primitive.
Tests don't often implement such primitives, they rely on the runtime
to provide them.
> Also, GCC tests are typically low-risk inputs that exercise specific
> parts of compiler passes, and are separate from the compiler. Because
> glibc tests are more low-level and more intertwined with glibc
> itself, a bad-LLM generated test is more likely to corrupt a platform
> testing glibc than one testing GCC. Although we should be on the
> lookout for this, we can't be perfect in discovering these problems.
> It's a greater risk for glibc than it is for gcc.
I think gcc tests and glibc tests are equivalent.
While glibc has more syscall wrappers, gcc has all of libstdc++ to test,
libffi, the sanitizers (ubsan, asan, etc), libgomp, etc. all which
exercise the host glibc and kernel in similar ways.
In my view this puts them on equivalent footing.
> Although I'm not opposed to having LLM-generated tests in glibc, if
> we do have them they need to be on a tighter leash than GCC tests
> are. The simplest option would be for the AI policy to treat tests
> like everything else; more complicated options are possible.
Why on a tighter leash?
I don't see any examples of leakage from tests into the library
(and I looked, there is actually one instance of leakage but it
doesn't apply to this case).
I don't see the tests as more or less complex than runtimes
shipped with the compiler.
--
Cheers,
Carlos.
More information about the Libc-alpha
mailing list