[Bug c++/92951] extern variable declaration doesn't behave properly for me

fportera2 at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Dec 16 08:46:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92951

--- Comment #2 from Filippo Portera <fportera2 at gmail dot com> ---
I printf the variable dimensions both in the main() that in:

void MeanSquaredError<InputDataType, OutputDataType>::Backward(
      int begin, int batch_size,
      const InputType&& input,
      const TargetType&& target,
      OutputType&& output)
{
  double gamma = 1;
  printf("n_rows = %d, n_cols = %d\n", traindata.n_rows, traindata.n_cols);


that I'm sure it is called inside the main function and before the first
main's printf.





Il giorno lun 16 dic 2019 alle ore 09:39 pinskia at gcc dot gnu.org <
gcc-bugzilla@gcc.gnu.org> ha scritto:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92951
>
> --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
> Is the printf before or after main?
>
> If before, then the problem is the order of variables initialized from
> different translational units is unspecified and therefore undefined.
>
> If after, then maybe something is changing them.
>
> --
> You are receiving this mail because:
> You reported the bug.


More information about the Gcc-bugs mailing list