Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Small Device C Compiler 3.6.0 released Date: Thu, 16 Jun 2016 09:07:54 -0700 Organization: None to speak of Lines: 31 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="26523"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+b/PywdX/zZrcilc298LXL" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:XxVtZE/okIGq1iN20Z+sux6JRGE= sha1:d2ZWFEn75W8MVkyG8abi8M4Eo4Y= Xref: csiph.com comp.lang.c:89296 David Brown writes: > On 16/06/16 14:06, BartC wrote: [...] >> I've looked at some more aspects of block-scopes. If I try this code: >> >> { >> int* p; >> { >> int A = 77; >> p = &A; >> } >> printf("*p=%d\n", *p); >> } >> >> then none of compilers I tried gives any sort of warning about it. (That >> is, Pelles C, lccwin, DMC, gcc, TCC and clang. gcc was given -Wall >> -Wextra -Wpedantic and the output was not filtered.) > > gcc warns about it - though the warning is the slightly cryptic > "warning: 'A' is used uninitialized in this function". gcc-5.2.0 and up print that warning. gcc-4.9.0 does not. Also, with gcc-4.9.0 and earlier, the output is "*p=77" at all optimization levels. [...] -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"