Skip to content
Snippets Groups Projects
Commit 5fd1c0c1 authored by Jakub Jelinek's avatar Jakub Jelinek Committed by Jakub Jelinek
Browse files

c-family: Fix up -Wsizeof-pointer-memaccess ICEs [PR117230]

In the following testcases, we ICE on all 4 function calls.
The problem is using TYPE_PRECISION on vector types (but guess it
would be similarly problematic on structures/unions/arrays).
The test only differentiates between suggestion what to do, whether
to supply explicit size because sizeof (*p) for
{,{,un}signed }char *p is not very likely what the user want, or
dereferencing the pointer, so I think limiting that suggestion
to integral types is ok.

2024-10-22  Jakub Jelinek  <jakub@redhat.com>

	PR c/117230
	* c-warn.cc (sizeof_pointer_memaccess_warning): Only compare
	TYPE_PRECISION of TREE_TYPE (type) to precision of char if
	TREE_TYPE (type) is integral type.

	* c-c++-common/Wsizeof-pointer-memaccess5.c: New test.
parent f616bc41
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment