lkml.org 
[lkml]   [2023]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [RFC] tools/nolibc: replace duplicated -ENOSYS return with single -ENOSYS return
Date
From: Ammar Faizi
> Sent: 30 August 2023 15:41
>
> On 8/28/23 4:51 AM, David Laight wrote:
> > I just found a(nother) clang bug:
> > int f(void) { return "a"[2]; }
> > compiles to just a 'return'.
>
> I don't think that's a bug. It's undefined behavior due to an
> out-of-bound read. What do you expect it to return?

I was actually expecting a warning/error if it didn't just read
the byte after the end of the string.

Just silently doing nothing didn't seem right for a modern compiler.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
\
 
 \ /
  Last update: 2023-08-30 20:50    [W:0.100 / U:0.708 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site