Re: About initialization of automatic variables

2023-04-18 Thread naoki ueda via Gcc-bugs
Ok, I see.

2023年4月18日(火) 17:27 Jonathan Wakely :

> The gcc-bugs@gcc.gnu.org list is for automated email from our Bugzilla
> database, please don't use it to report bugs or to ask questions about
> how GCC works.
>
> For questions about using GCC send email to gcc-h...@gcc.gnu.org and
> to report bugs please use bugzilla: https://gcc.gnu.org/bugs/
>
> Thanks!
>
>
>


Re: About initialization of automatic variables

2023-04-18 Thread Jonathan Wakely via Gcc-bugs
The gcc-bugs@gcc.gnu.org list is for automated email from our Bugzilla
database, please don't use it to report bugs or to ask questions about
how GCC works.

For questions about using GCC send email to gcc-h...@gcc.gnu.org and
to report bugs please use bugzilla: https://gcc.gnu.org/bugs/

Thanks!




Re: About initialization of automatic variables

2023-04-18 Thread naoki ueda via Gcc-bugs
Ok, thanks!

2023年4月18日(火) 16:06 Andreas Schwab :

> On Apr 18 2023, naoki ueda via Gcc-bugs wrote:
>
> > The attached code says "int a = 100;", but it should normally be
> > initialized with an "undefined value", but in the case of gcc-10, it is
> > initialized with "0". Isn't this a bug in gcc-10?
>
> 0 is just one instance of "undefined value".
>
> --
> Andreas Schwab, sch...@linux-m68k.org
> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
> "And now for something completely different."
>


Re: About initialization of automatic variables

2023-04-18 Thread Andreas Schwab
On Apr 18 2023, naoki ueda via Gcc-bugs wrote:

> The attached code says "int a = 100;", but it should normally be
> initialized with an "undefined value", but in the case of gcc-10, it is
> initialized with "0". Isn't this a bug in gcc-10?

0 is just one instance of "undefined value".

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


About initialization of automatic variables

2023-04-17 Thread naoki ueda via Gcc-bugs
The attached code says "int a = 100;", but it should normally be
initialized with an "undefined value", but in the case of gcc-10, it is
initialized with "0". Isn't this a bug in gcc-10?
#include 

int main(void)
{
int n;

for (n = 1;n <= 5;n++) {
switch (n)
{   int a = 100;
static int b = 200;
a = 111;
b = 222;
case 1:
++a; ++b;
printf("case1: a = %d b = %d\n", a, b);
break;
case 3:
++a; ++b;
printf("case3: a = %d b = %d\n", a, b);
}
}
for (n = 1;n <= 3;n++) {
int c = 300;
static int d = 400;
++c; ++d;
printf("for: c = %d d = %d\n", c, d);
}
return 0;
}