[Patch, Fortran] PR92896 [10 Regression] Fix - Prevent character conversion in array constructor
Steve Kargl
sgk@troutmask.apl.washington.edu
Tue Dec 17 17:47:00 GMT 2019
On Tue, Dec 17, 2019 at 05:28:05PM +0000, Mark Eggleston wrote:
>
> On 17/12/2019 17:06, Steve Kargl wrote:
> > On Tue, Dec 17, 2019 at 03:41:41PM +0000, Mark Eggleston wrote:
> >> gcc/fortran/ChangeLog
> >>
> >>    Mark Eggleston <mark.eggleston@codethink.com>
> >>
> >> Â Â Â PR fortran/92896
> >> Â Â Â * array.c (walk_array_constructor): Replace call to cfg_convert_type
> > s/cfg_convert_type/gfc_convert_type
> >
> >> Â Â Â with call to gfc_convert_type_warn with new argument set to true.
> >> Â Â Â (check_element_type): Replace call to cfg_convert_type with call to
> >> Â Â Â gfc_convert_type_warn with new argument set to true.
> >> Â Â Â * gfortran.h: Add argument "array" to gfc_convert_type_warn default
> >> Â Â Â value set to false.
> > Do all current uses of gfc_convert_type_warn need to be updated
> > to account for the new parameter? That is, doesn't this introduce
> > a mismatch in the prototype and existing code?
>
> I used a default value so all existing calls remain as they are and
> default to false. So no mismatch.
>
% cat a.h
#ifndef _STDBOOL_H_
#include <stdbool.h>
#endif
float foo(int, float, bool tmp = false);
% cat a.c
#include "a.h"
void
bar(float x)
{
int n;
n = 1;
x = foo(n, x);
}
% /usr/home/sgk/work/x/bin/gcc -Wall -c a.c
In file included from a.c:2:
a.h:1:32: error: expected ';', ',' or ')' before '=' token
1 | float foo(int, float, bool tmp = false);
| ^
a.c: In function 'bar':
a.c:8:7: warning: implicit declaration of function 'foo' [-Wimplicit-function-declaration]
8 | x = foo(n, x);
| ^~~
--
Steve
More information about the Gcc-patches
mailing list