public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/103492] New: 2 * new warnings in clang build
@ 2021-11-30 10:54 dcb314 at hotmail dot com
  2021-11-30 10:59 ` [Bug c/103492] " jakub at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: dcb314 at hotmail dot com @ 2021-11-30 10:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103492
           Summary: 2 * new warnings in clang build
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

../../trunk.git/gcc/fold-const-call.c:432:1: warning: non-void function does
not return a value in all control paths [-Wreturn-type]
../../trunk.git/gcc/fold-const-call.c:465:1: warning: non-void function does
not return a value in all control paths [-Wreturn-type]

It looks like clang is being a bit keen. 

Suggest add a simple return false at the end of a couple of functions.
Either that or start decorating the switch statements in some way.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c/103492] 2 * new warnings in clang build
  2021-11-30 10:54 [Bug c/103492] New: 2 * new warnings in clang build dcb314 at hotmail dot com
@ 2021-11-30 10:59 ` jakub at gcc dot gnu.org
  2021-11-30 11:58 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-11-30 10:59 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Given that the switch uses arg->cl expression which is an unsigned int cl : 2
bitfield and the switch has all the 4 values covered, that clearly looks like a
clang bug.
The gcc_unreachable () has been removed because of the -Wunreachable-code
warnings...

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c/103492] 2 * new warnings in clang build
  2021-11-30 10:54 [Bug c/103492] New: 2 * new warnings in clang build dcb314 at hotmail dot com
  2021-11-30 10:59 ` [Bug c/103492] " jakub at gcc dot gnu.org
@ 2021-11-30 11:58 ` pinskia at gcc dot gnu.org
  2021-12-06  9:59 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-30 11:58 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The gcc_unreachable called was explicitly removed in r12-5576-ga3b31fe3692894e8
. The bug is obvious in clang where the switch only can have 4 values as it is
a load from a bitfield of size of 2 bits.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c/103492] 2 * new warnings in clang build
  2021-11-30 10:54 [Bug c/103492] New: 2 * new warnings in clang build dcb314 at hotmail dot com
  2021-11-30 10:59 ` [Bug c/103492] " jakub at gcc dot gnu.org
  2021-11-30 11:58 ` pinskia at gcc dot gnu.org
@ 2021-12-06  9:59 ` pinskia at gcc dot gnu.org
  2021-12-06 12:50 ` marxin at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-06  9:59 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 103575 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c/103492] 2 * new warnings in clang build
  2021-11-30 10:54 [Bug c/103492] New: 2 * new warnings in clang build dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2021-12-06  9:59 ` pinskia at gcc dot gnu.org
@ 2021-12-06 12:50 ` marxin at gcc dot gnu.org
  2021-12-06 12:53 ` dcb314 at hotmail dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-06 12:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> The gcc_unreachable called was explicitly removed in
> r12-5576-ga3b31fe3692894e8 . The bug is obvious in clang where the switch
> only can have 4 values as it is a load from a bitfield of size of 2 bits.

All right! Is there any Clang bug report for this, or should I create it?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c/103492] 2 * new warnings in clang build
  2021-11-30 10:54 [Bug c/103492] New: 2 * new warnings in clang build dcb314 at hotmail dot com
                   ` (3 preceding siblings ...)
  2021-12-06 12:50 ` marxin at gcc dot gnu.org
@ 2021-12-06 12:53 ` dcb314 at hotmail dot com
  2021-12-06 13:04 ` marxin at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dcb314 at hotmail dot com @ 2021-12-06 12:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to Martin Liška from comment #4)
> All right! Is there any Clang bug report for this, or should I create it?

Option 2, I think. 

I have a 0.0 % success rate at getting any response to any clang bug I report
;-<

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c/103492] 2 * new warnings in clang build
  2021-11-30 10:54 [Bug c/103492] New: 2 * new warnings in clang build dcb314 at hotmail dot com
                   ` (4 preceding siblings ...)
  2021-12-06 12:53 ` dcb314 at hotmail dot com
@ 2021-12-06 13:04 ` marxin at gcc dot gnu.org
  2021-12-06 23:03 ` pinskia at gcc dot gnu.org
  2021-12-07  8:09 ` marxin at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-06 13:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
I'm going to do that, but right now they migrate bugzilla to GitHub issues..

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c/103492] 2 * new warnings in clang build
  2021-11-30 10:54 [Bug c/103492] New: 2 * new warnings in clang build dcb314 at hotmail dot com
                   ` (5 preceding siblings ...)
  2021-12-06 13:04 ` marxin at gcc dot gnu.org
@ 2021-12-06 23:03 ` pinskia at gcc dot gnu.org
  2021-12-07  8:09 ` marxin at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-06 23:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
reduced testcase for clang's warning:
struct f
{
    unsigned a:2;
    unsigned b:(32-2);
};

int g(struct f *b)
{
    switch (b->a)
    {
        case 0:
          return 2;
        case 1:
          return 3;
        case 2:
          return 5;
        case 3:
          return 1;
    }
}

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c/103492] 2 * new warnings in clang build
  2021-11-30 10:54 [Bug c/103492] New: 2 * new warnings in clang build dcb314 at hotmail dot com
                   ` (6 preceding siblings ...)
  2021-12-06 23:03 ` pinskia at gcc dot gnu.org
@ 2021-12-07  8:09 ` marxin at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-07  8:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Martin Liška <marxin at gcc dot gnu.org> ---
Even simpler test-case:

struct A
{
  unsigned int val: 1;
};

int foo(struct A *a)
{
  switch (a->val)
  {
    case 0:
      return 123;
    case 1:
      return 456;
  }
}

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-12-07  8:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30 10:54 [Bug c/103492] New: 2 * new warnings in clang build dcb314 at hotmail dot com
2021-11-30 10:59 ` [Bug c/103492] " jakub at gcc dot gnu.org
2021-11-30 11:58 ` pinskia at gcc dot gnu.org
2021-12-06  9:59 ` pinskia at gcc dot gnu.org
2021-12-06 12:50 ` marxin at gcc dot gnu.org
2021-12-06 12:53 ` dcb314 at hotmail dot com
2021-12-06 13:04 ` marxin at gcc dot gnu.org
2021-12-06 23:03 ` pinskia at gcc dot gnu.org
2021-12-07  8:09 ` marxin at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).