This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug sanitizer/81275] [5/6/7/8 Regression] -fsanitize=thread produce incorrect -Wreturn-type warning


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81275

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #4)
> Marek, could we reuse the fallthrough warning infrastructure for this to
> determine whether there is a possible fallthrough or not?
> Though, trying:
> int
> foo (int a, int b, int c)
> {
>   switch (c)
>     {
>     case 5:
>       switch (a)
> 	{
> 	case 0:
> 	  switch (b)
> 	    {
> 	    default:
> 	      return 0;
> 	    }
> 	  break;
> #ifdef FT
> 	case 7:
> 	  break;
> #endif
> 	default:
> 	  return 0;
> 	}
>     case 6:
>       return 7;
>     }
>   return 8;
> }
> 
> we don't warn about the fallthrough from case 5 to case 6 no matter if FT is
> defined (in that case there is obvious fallthrough, say for foo (7, 0, 5), or
> when FT is not defined (then there isn't, but gimple_seq_may_fallthru
> doesn't know that).  

Unfortunately, not yet, because -Wimplicit-fallthrough doesn't scan nested
switches (PR79153).

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]