Bug 84818 - integer_onep must not be used for i18n
Summary: integer_onep must not be used for i18n
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 8.0
: P3 normal
Target Milestone: ---
Assignee: Martin Sebor
URL:
Keywords: diagnostic, patch
Depends on:
Blocks:
 
Reported: 2018-03-11 16:51 UTC by Roland Illig
Modified: 2018-03-30 21:04 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2018-03-28 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roland Illig 2018-03-11 16:51:51 UTC
In English, the following idiom is correct:

	    warning_at (loc, opt,
			(integer_onep (range[0])
			 ? G_("%K%qD writing %E byte into a region "
			      "of size %E overflows the destination")
			 : G_("%K%qD writing %E bytes into a region "
			      "of size %E overflows the destination")),

In other languages, this fails.

- In French, 0 and 1 both use the singular.
- In Polish, Arabic and several other languages there are up to 6 plural forms.

See http://www.unicode.org/cldr/charts/29/supplemental/language_plural_rules.html
Comment 1 Martin Sebor 2018-03-28 22:28:05 UTC
Confirmed.
Comment 2 Martin Sebor 2018-03-29 14:46:27 UTC
Patch: https://gcc.gnu.org/ml/gcc-patches/2018-03/msg01548.html
Comment 3 Martin Sebor 2018-03-30 21:04:33 UTC
Fixed via r258983.
Comment 4 Martin Sebor 2018-03-30 21:04:39 UTC
Author: msebor
Date: Fri Mar 30 21:04:06 2018
New Revision: 258983

URL: https://gcc.gnu.org/viewcvs?rev=258983&root=gcc&view=rev
Log:
PR tree-optimization/84818 - integer_onep must not be used for i18n

gcc/ChangeLog:

	PR tree-optimization/84818
	* builtins.c (check_access): Use warning_n.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/builtins.c