Bug 1213600

Summary: gcc13 fails to recognize range of values in switch statement
Product: [openSUSE] openSUSE Tumbleweed Reporter: Olaf Hering <ohering>
Component: BasesystemAssignee: Richard Biener <rguenther>
Status: NEW --- QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None    
Version: Current   
Target Milestone: ---   
Hardware: x86-64   
OS: Linux   
See Also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110839
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: source_genCases_f16.c.i.xz

Description Olaf Hering 2023-07-24 12:32:06 UTC
Created attachment 868399 [details]
source_genCases_f16.c.i.xz

random_ui8 returns an unsigned char.
(u8 & 7) means values between zero and seven need to be handled.

genCases_f16.c: In function 'f16Random':
genCases_f16.c:336:1: error: control reaches end of non-void function [-Werror=return-type]
Comment 1 Richard Biener 2023-07-28 07:36:59 UTC
The diagnostic happens before optimization and thus analysis of all case values
and an unreachable 'default' case is emitted by gimplification.

Reported upstream.
Comment 2 Richard Biener 2023-07-28 07:40:53 UTC
You can put __builtin_unreachable (); after the switch to silence the diagnostic.