pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #16823: Unreachable code
3+ messages / 3 participants
[nested] [flat]

* BUG #16823: Unreachable code
@ 2021-01-13 15:59  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 3+ messages in thread

From: PG Bug reporting form @ 2021-01-13 15:59 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: ruga@protonmail.com

The following bug has been logged on the website:

Bug reference:      16823
Logged by:          Rupert
Email address:      ruga@protonmail.com
PostgreSQL version: 13.1
Operating system:   openbsd
Description:        

localtime.c:135:40: warning: code will never be executed
[-Wunreachable-code]
                result -= !TWOS_COMPLEMENT(int32) && result != 0;
                                                     ^~~~~~
localtime.c:161:40: warning: code will never be executed
[-Wunreachable-code]
                result -= !TWOS_COMPLEMENT(int64) && result != 0;
                                                     ^~~~~~
localtime.c:299:52: warning: code will never be executed
[-Wunreachable-code]
                                = ((TYPE_SIGNED(pg_time_t) ? at < TIME_T_MIN
: at < 0)
                                                                            
  ^~
localtime.c:1564:58: warning: code will never be executed
[-Wunreachable-code]
                  ? (TYPE_SIGNED(pg_time_t) ? TIME_T_MIN - j <= *tp : -1 - j
< *tp)
                                                                       ^
4 warnings generated.
bootparse.c:2132:14: warning: code will never be executed
[-Wunreachable-code]
  yyresult = 2;
             ^
1 warning generated.
bootstrap.c:465:4: warning: code will never be executed
[-Wunreachable-code]
                        proc_exit(1);           /* should never return */
                        ^~~~~~~~~
bootstrap.c:460:4: warning: code will never be executed
[-Wunreachable-code]
                        proc_exit(1);           /* should never return */
                        ^~~~~~~~~
bootstrap.c:454:4: warning: code will never be executed
[-Wunreachable-code]
                        proc_exit(1);           /* should never return */
                        ^~~~~~~~~
bootstrap.c:449:4: warning: code will never be executed
[-Wunreachable-code]
                        proc_exit(1);           /* should never return */
                        ^~~~~~~~~
bootstrap.c:444:4: warning: code will never be executed
[-Wunreachable-code]
                        proc_exit(1);           /* should never return */
                        ^~~~~~~~~
5 warnings generated.
main.c:211:2: warning: code will never be executed [-Wunreachable-code]
        abort();                                        /* should not get
here */
        ^~~~~
1 warning generated.
heapam.c:5364:11: warning: code will never be executed
[-Wunreachable-code]
        result = TM_Ok;
                 ^~~~~
1 warning generated.
postmaster.c:1419:2: warning: code will never be executed
[-Wunreachable-code]
        abort();                                        /* not reached */
        ^~~~~
postmaster.c:5513:3: warning: code will never be executed
[-Wunreachable-code]
                ExitPostmaster(0);
                ^~~~~~~~~~~~~~
postmaster.c:5892:4: warning: code will never be executed
[-Wunreachable-code]
                        exit(1);                        /* should not get
here */
                        ^~~~
3 warnings generated.
repl_gram.c:1942:14: warning: code will never be executed
[-Wunreachable-code]
  yyresult = 2;
             ^
1 warning generated.
scan.c:6678:13: warning: code will never be executed [-Wunreachable-code]
                                        if ( !
yyg->yy_did_buffer_switch_on_eof )
                                               ^~~
walsender.c:368:2: warning: code will never be executed
[-Wunreachable-code]
        abort();                                        /* keep the compiler
quiet */
        ^~~~~
1 warning generated.
1 warning generated.
ri_triggers.c:1554:3: warning: code will never be executed
[-Wunreachable-code]
                ExecDropSingleTupleTableSlot(slot);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
fe-connect.c:1112:16: warning: code will never be executed
[-Wunreachable-code]
                                ch->host = strdup(DefaultHost);
                                           ^~~~~~
1 warning generated.
pgc.c:3825:14: warning: code will never be executed [-Wunreachable-code]
                                        if ( ! (yy_did_buffer_switch_on_eof)
)
                                               
^~~~~~~~~~~~~~~~~~~~~~~~~~~
variable.c:472:4: warning: code will never be executed
[-Wunreachable-code]
                        struct ECPGstruct_member *p;
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
data.c:372:6: warning: code will never be executed [-Wunreachable-code]
                                        long            res;
                                        ^~~~~~~~~~~~~~~~~~~~
execute.c:567:5: warning: code will never be executed [-Wunreachable-code]
                                int                     element;
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
1 warning generated.
1 warning generated.
psqlscan.c:3387:13: warning: code will never be executed
[-Wunreachable-code]
                                        if ( !
yyg->yy_did_buffer_switch_on_eof )
                                               ^~~
1 warning generated.
localtime.c:135:40: warning: code will never be executed
[-Wunreachable-code]
                result -= !TWOS_COMPLEMENT(int32) && result != 0;
                                                     ^~~~~~
localtime.c:161:40: warning: code will never be executed
[-Wunreachable-code]
                result -= !TWOS_COMPLEMENT(int64) && result != 0;
                                                     ^~~~~~
localtime.c:299:52: warning: code will never be executed
[-Wunreachable-code]
                                = ((TYPE_SIGNED(pg_time_t) ? at < TIME_T_MIN
: at < 0)
                                                                            
  ^~
localtime.c:1564:58: warning: code will never be executed
[-Wunreachable-code]
                  ? (TYPE_SIGNED(pg_time_t) ? TIME_T_MIN - j <= *tp : -1 - j
< *tp)
                                                                       ^
4 warnings generated.
file.c:355:2: warning: code will never be executed [-Wunreachable-code]
        unlink(new_link_file);
        ^~~~~~
1 warning generated.
exprparse.c:1869:14: warning: code will never be executed
[-Wunreachable-code]
  yyresult = 2;
             ^
1 warning generated.
psqlscanslash.c:2105:13: warning: code will never be executed
[-Wunreachable-code]
                                        if ( !
yyg->yy_did_buffer_switch_on_eof )
                                               ^~~
1 warning generated.
pl_gram.c:4924:14: warning: code will never be executed
[-Wunreachable-code]
  yyresult = 2;
             ^
1 warning generated.



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

* Re: BUG #16823: Unreachable code
@ 2021-01-13 16:42  Tom Lane <tgl@sss.pgh.pa.us>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2021-01-13 16:42 UTC (permalink / raw)
  To: ruga@protonmail.com; +Cc: pgsql-bugs@lists.postgresql.org

PG Bug reporting form <noreply@postgresql.org> writes:
> localtime.c:135:40: warning: code will never be executed
> [-Wunreachable-code]
>                 result -= !TWOS_COMPLEMENT(int32) && result != 0;
>                                                      ^~~~~~

[ and much more in the same vein ]

We're unlikely to change any of these, so I'd recommend turning off
-Wunreachable-code.

localtime.c is a clone of the IANA timezone code, so we're certainly
not going to change it unless they do (which I doubt they would).
bootparse.c, and some of the other files you mention, are code generated
by bison, which we have no control over.  Most of the rest of these
are already manually commented as being unreachable; they're there
partly for belt-and-suspenders reasons, and partly because some other
compilers will warn if we don't have them.

			regards, tom lane





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

* Re: BUG #16823: Unreachable code
@ 2021-01-17 22:51  Rupert Gallagher <ruga@protonmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Rupert Gallagher @ 2021-01-17 22:51 UTC (permalink / raw)
  To: tgl@sss.pgh.pa.us; +Cc: pgsql-bugs@lists.postgresql.org

Turning off the warning will not make the code reachable. Non reachable means that it will never be executed. If you are sure that it is ok to never execute it, then remove it.

-------- Original Message --------
On Jan 13, 2021, 17:42, Tom Lane < tgl@sss.pgh.pa.us> wrote:
PG Bug reporting form <noreply@postgresql.org> writes:
> localtime.c:135:40: warning: code will never be executed
> [-Wunreachable-code]
> result -= !TWOS_COMPLEMENT(int32) && result != 0;
> ^~~~~~
[ and much more in the same vein ]
We're unlikely to change any of these, so I'd recommend turning off
-Wunreachable-code.
localtime.c is a clone of the IANA timezone code, so we're certainly
not going to change it unless they do (which I doubt they would).
bootparse.c, and some of the other files you mention, are code generated
by bison, which we have no control over. Most of the rest of these
are already manually commented as being unreachable; they're there
partly for belt-and-suspenders reasons, and partly because some other
compilers will warn if we don't have them.
regards, tom lane

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


end of thread, other threads:[~2021-01-17 22:51 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-01-13 15:59 BUG #16823: Unreachable code PG Bug reporting form <noreply@postgresql.org>
2021-01-13 16:42 ` Tom Lane <tgl@sss.pgh.pa.us>
2021-01-17 22:51   ` Rupert Gallagher <ruga@protonmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox