public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/97829] New: pragma ignore "-Wint-in-bool-context" is ignored for _Bool _Complex interaction
@ 2020-11-14 17:52 antiquarktv at gmail dot com
0 siblings, 0 replies; only message in thread
From: antiquarktv at gmail dot com @ 2020-11-14 17:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97829
Bug ID: 97829
Summary: pragma ignore "-Wint-in-bool-context" is ignored for
_Bool _Complex interaction
Product: gcc
Version: 10.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: antiquarktv at gmail dot com
Target Milestone: ---
#include <stdio.h>
#include <stdlib.h>
// gcc -std=c11 -Wall -Wextra -pedantic main.c
#pragma GCC diagnostic ignored "-Wint-in-bool-context"
#pragma GCC diagnostic ignored "-Wunused-variable"
int main()
{
double _Complex x = 1;
_Bool b = 1;
b *= x; // prints int-in-bool-context warning.
_Bool c = 2; // unused var warning not printed.
}
/*
The code above prints the following when compiled:
gcc -std=c11 -Wall -Wextra -pedantic main.c
main.c: In function ‘main’:
cc1: warning: ‘*’ in boolean context, suggest ‘&&’ instead
[-Wint-in-bool-context]
cc1: warning: ‘*’ in boolean context, suggest ‘&&’ instead
[-Wint-in-bool-context]
The Wint-in-bool-context warning is printed by cc1 as a result of the _Bool *=
_Complex operation
If this code is compiled with -Wno-int-in-bool-context on the command line,
there is no warning:
gcc -std=c11 -Wall -Wextra -pedantic main.c -Wno-int-in-bool-context
(produces no output).
*/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-11-14 17:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-14 17:52 [Bug c/97829] New: pragma ignore "-Wint-in-bool-context" is ignored for _Bool _Complex interaction antiquarktv at gmail dot com
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).