This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR18785: Support non-native execution charsets


On Wed, 22 Dec 2004, Joseph S. Myers wrote:
> On Wed, 22 Dec 2004, Roger Sayle wrote:
> > We are still talking about the review in which you wrote
> > "I think a conservative patch should only..."?
>
> Yes.  A conservative patch should only disable the dangerous
> optimizations, not the majority which are safe.  It shouldn't disable
> diagnostics: I think the common case is that both source and execution
> character sets are supersets of ASCII, in which case the diagnostics are
> all correct, and in the uncommon case the diagnostics can be disabled with
> -Wno-format.

But my patch is even more generous than that.  Not only do we continue
to report warnings and perform optimizations when both source and
execution character sets are supersets of ASCII (undoubtedly the most
common case), but we also continue to report warnings and perform
optimizations when the source and execution characters sets are both
EBCDIC.  Infact, we continue to report warnings and perform optimizations
whenever the source and execution character sets are the same, whatever
that charset is.

It does however prevent issuing incorrect diagnostics when we're unsure
of the execution character set, which is with this patch, is *only*
when the user explicitly specifies -fexec-charset (on any platform).

As an example consider the following

#include <stdio.h>

void foo(const char *ptr)
{
  printf("%s\n",ptr);
}

which when compiled on Linux with mainline CVS, using the command line
gcc -c -Wall -fexec-charset=IBM1047 warn.c

generates the inappropriate/incorrect diagnostics:
warn.c: In function `foo':
warn.c:5: warning: spurious trailing `%' in format
warn.c:5: warning: too many arguments for format

when compiled with just "gcc -c -Wall" all is fine.



There are several comments in my patch on aspects/issues that could
be improved upon that would require substantial internal interface
changes to allow the use of iconv, and or detect that -fexec-charset
is "compatible" with the source charset, or possibly that the source
and execution charsets are both supersets of ASCII.  None of these
additional improvements, in my view is suitable for stage3, nor
address the 4.0 regression in PR middle-end/18785.


I'm very aware that you don't have the authority to approve much of
this patch as much of it is outside the C front-end, but for the
benefit of other reviewers, could you just confirm that you consider
my patch a considerable improvement on the current situation, and
that you don't dispute that this resolves PR18785?  At the very least
it corrects the inappropriate -Wformat message above!

Roger
--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]