I know this is weird question, but just bad curious.
char* ptr = 0;
strcpy( (char*) &ptr, "UB?");
This code means 'I will use the memory of ptr as a char array.' I think 'it's absolutely UB', but someone says 'it's not UB until you dereference'. It is not UB? How can this awful code not be UB?
C17 ยง6.5 paragraph 6 includes:
The effective type of the object denoted by
ptrischar *.Paragraph 7 includes:
The object denoted by
ptris having its stored value accessed by an lvalue expression of character type (via thestrcpyfunction which interprets characters as if they had typeunsigned char). This is not UB.