[Bug driver/80545] option -Wstringop-overflow not recognized by Fortran

2019-08-28 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80545

--- Comment #9 from Martin Sebor  ---
Author: msebor
Date: Wed Aug 28 16:24:38 2019
New Revision: 274996

URL: https://gcc.gnu.org/viewcvs?rev=274996&root=gcc&view=rev
Log:
PR driver/80545 - option -Wstringop-overflow not recognized by Fortran

gcc/ChangeLog:

PR driver/80545
* opts-common.c (option_enabled): Correct checking for language
options.


Modified:
trunk/gcc/ChangeLog
trunk/gcc/opts-common.c

[Bug driver/80545] option -Wstringop-overflow not recognized by Fortran

2019-08-08 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80545

Martin Sebor  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from Martin Sebor  ---
I believe r273771 fully this bug.

[Bug driver/80545] option -Wstringop-overflow not recognized by Fortran

2019-07-24 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80545

--- Comment #7 from Martin Sebor  ---
Author: msebor
Date: Wed Jul 24 20:34:03 2019
New Revision: 273771

URL: https://gcc.gnu.org/viewcvs?rev=273771&root=gcc&view=rev
Log:
PR driver/80545 - option -Wstringop-overflow not recognized by Fortran

gcc/cp/ChangeLog:

PR driver/80545
* decl.c (finish_function): Use lang_mask.

gcc/testsuite/ChangeLog:

PR driver/80545
* gcc.misc-tests/help.exp: Add tests.
* lib/options.exp: Handle C++.

gcc/ChangeLog:

PR driver/80545
* diagnostic.c (diagnostic_classify_diagnostic): Use lang_mask.
(diagnostic_report_diagnostic): Same.
* diagnostic.h (diagnostic_context::option_enabled): Add an argument.
(diagnostic_context::lang_mask): New data member.
* ipa-pure-const.c (suggest_attribute): Use
lang_hooks.option_lang_mask ().
* opts-common.c (option_enabled): Handle new argument.
(get_option_state): Pass an additional argument.
* opts.c (print_filtered_help): Print supported languages for
unsupported options.  Adjust printing of current state.
* opts.h (option_enabled): Add argument.
* toplev.c (print_switch_values): Use lang_mask.
(general_init): Set global_dc->lang_mask.


Modified:
trunk/gcc/ChangeLog
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/decl.c
trunk/gcc/diagnostic.c
trunk/gcc/diagnostic.h
trunk/gcc/ipa-pure-const.c
trunk/gcc/opts-common.c
trunk/gcc/opts.c
trunk/gcc/opts.h
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.misc-tests/help.exp
trunk/gcc/testsuite/lib/options.exp
trunk/gcc/toplev.c

[Bug driver/80545] option -Wstringop-overflow not recognized by Fortran

2019-07-22 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80545

--- Comment #6 from Martin Sebor  ---
Patch: https://gcc.gnu.org/ml/gcc-patches/2019-07/msg01457.html

[Bug driver/80545] option -Wstringop-overflow not recognized by Fortran

2019-07-21 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80545

--- Comment #5 from Martin Sebor  ---
As best I can tell the problem is that the option_enabled() function doesn't
consider the front-end's lang_mask and returns true even for options that are
not supported in the current language.  I'm working on a fix.

[Bug driver/80545] option -Wstringop-overflow not recognized by Fortran

2017-09-05 Thread janus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80545

--- Comment #4 from janus at gcc dot gnu.org ---
(In reply to Martin Sebor from comment #3)
> Patch posted for review:
> https://gcc.gnu.org/ml/gcc-patches/2017-04/msg01544.html

It seems this patch has been committed as part of r247401 (but unfortunately
not mentioned in the ChangeLog).

However, I still see warnings like:

f951: Warning: ‘__builtin_memset’ writing between 8 and 17179869176 bytes into
a region of size 0 overflows the destination [-Wstringop-overflow=]

in Fortran code with a recent trunk build:

gcc version 8.0.0 20170831 (experimental) [trunk revision 251566] (GCC)


I see that there are two entries for Wstringop-overflow in c.opt, but only one
of them has LangEnabledBy(). Could that be the problem?

[Bug driver/80545] option -Wstringop-overflow not recognized by Fortran

2017-04-28 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80545

Martin Sebor  changed:

   What|Removed |Added

   Keywords||diagnostic, patch

--- Comment #3 from Martin Sebor  ---
Patch posted for review:
https://gcc.gnu.org/ml/gcc-patches/2017-04/msg01544.html

[Bug driver/80545] option -Wstringop-overflow not recognized by Fortran

2017-04-28 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80545

Martin Sebor  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |msebor at gcc dot 
gnu.org

[Bug driver/80545] option -Wstringop-overflow not recognized by Fortran

2017-04-28 Thread janus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80545

--- Comment #2 from janus at gcc dot gnu.org ---
(In reply to Richard Biener from comment #1)
> I suggest to enable them only for C family languages (I notice the options
> do not use EnabledBy()).

I guess that would also fix the bogus warning from PR 79929 ...

[Bug driver/80545] option -Wstringop-overflow not recognized by Fortran

2017-04-28 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80545

Richard Biener  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-04-28
 Ever confirmed|0   |1

--- Comment #1 from Richard Biener  ---
I suggest to enable them only for C family languages (I notice the options
do not use EnabledBy()).

Supposedly the option machinery initializes warn_stringop_overflow to 2 even
when not in the set of options it is guarded with:

Wstringop-overflow=
C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_stringop_overflow)
Init(2) Warning
Under the control of Object Size type, warn about buffer overflow in string
manipulation functions like memcpy and strcpy.