Re: [PATCH v5 5/9] powerpc/mm/book3s64: Update tlb flush routines to take a page walk cache flush argument
From: Segher Boessenkool <hidden>
Date: 2021-05-19 14:24:58
Also in:
linux-mm
On Wed, May 19, 2021 at 06:37:44AM -0700, Guenter Roeck wrote:
On 5/19/21 5:03 AM, Segher Boessenkool wrote:quoted
On Tue, May 18, 2021 at 07:45:14PM -0500, Segher Boessenkool wrote:quoted
And it actually explicitly is undefined behaviour in C90 already (3.6.6.4 in C90, 6.8.6.4 in C99 and later).... but there is a GCC extension that allows this by default: <https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wreturn-type> For C only, warn about a 'return' statement with an expression in a function whose return type is 'void', unless the expression type is also 'void'. As a GNU extension, the latter case is accepted without a warning unless '-Wpedantic' is used.In C99: "6.8.6.4 The return statement Constraints A return statement with an expression shall not appear in a function whose return type is void. A return statement without an expression shall only appear in a function whose return type is void." Sounds like invalid to me, not just undefined behavior.
I don't know what "invalid" would mean here other than UB, it isn't a specific defined term, unlike the latter, which is precisely defined in 3.4.3/1: undefined behavior behavior, upon use of a nonportable or erroneous program construct or of erroneous data, for which this International Standard imposes no requirements This is the strongest thing the standard can say, it is not Law, it does not prohibit anyone from doing anything :-) "Shall" and "shall not" X means it is undefined behaviour if X (or its inverse) is violated. See 4.2: If a ''shall'' or ''shall not'' requirement that appears outside of a constraint or runtime-constraint is violated, the behavior is undefined. Undefined behavior is otherwise indicated in this International Standard by the words ''undefined behavior'' or by the omission of any explicit definition of behavior. There is no difference in emphasis among these three; they all describe ''behavior that is undefined''. which also explains that what you call "invalid" has undefined behaviour just as well, most likely. Segher