[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] tests: dissuade unwanted clang optimization
From: |
Bruno Haible |
Subject: |
Re: [PATCH] tests: dissuade unwanted clang optimization |
Date: |
Fri, 22 Nov 2024 16:50:51 +0100 |
Hi Paul,
Paul Eggert wrote:
> Pacify Apple clang 14.0.0 (clang-1400.0.29.202) for
> arm64-apple-darwin21.6.0 on test-memset_explicit.c,
> which otherwise complains “warning: null passed to a callee that
> requires a non-null argument [-Wnonnull]” and presumably could
> do an unwanted optimization based on this analysis.
I don't formally object to this patch, but I think it was unnecessary.
The purpose of these tests is to show which uses of the functions a user
can do and can expect to work (even with warnings).
I had used 'volatile int value' variables because I had observed actual
unwanted optimizations from clang, which did not make sense to me.
If we had encountered other unwanted optimizations from clang or gcc,
I would have been all in favour of this patch.
But just for a warning? The tests now give the impression that direct
use of memcpy etc. with NULL and 0 arguments is unreliable. Which — as we
know so far — isn't.
Bruno