Hi Richard, On 12/7/22 09:17, Richard Biener wrote: [...] >> The warnings are invalid. While it's true that I'm referencing a pointer of >> size 0, it's false that I'm "accessing 1 byte" in that region. I guess this is >> all about the bogus design of 'static' in ISO C, where you can have an array >> parameter of size 0, which is very useful in cases like this one. > > It looks like we run into pass_waccess::maybe_check_access_sizes doing > > if (sizidx == -1) > { > /* If only the pointer attribute operand was specified and > not size, set SIZE to the greater of MINSIZE or size of > one element of the pointed to type to detect smaller > objects (null pointers are diagnosed in this case only > if the pointer is also declared with attribute nonnull. */ > if (access.second.minsize > && access.second.minsize != HOST_WIDE_INT_M1U) > access_nelts = build_int_cstu (sizetype, access.second.minsize); > else if (VOID_TYPE_P (argtype) && access.second.mode == access_none) > /* Treat access mode none on a void* argument as expecting > as little as zero bytes. */ > access_nelts = size_zero_node; > else > access_nelts = size_one_node; > > and use size_one_node as fallback - it either doesn't consider [0] "valid" or > for some reason chooses to interpret it as "unknown". Can you file a bugreport > please? Sure; will do! Cheers, Alex > > Martin? > > Richard. --