public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <tobias@codesourcery.com>
To: Harald Anlauf <anlauf@gmx.de>, fortran <fortran@gcc.gnu.org>,
	gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] PR fortran/50549 - should detect different type parameters in structure constructors
Date: Tue, 29 Mar 2022 09:14:04 +0200	[thread overview]
Message-ID: <89773980-593c-727a-28c9-d3304cd1aa78@codesourcery.com> (raw)
In-Reply-To: <f2949a36-a8c3-3294-3d76-157e5b281151@gmx.de>

Hi Harald,

On 28.03.22 22:03, Harald Anlauf via Fortran wrote:
> All current cases of printing a HOST_WIDE_INT in gcc/fortran/ use
> 'sprintf', and I did not find any other use of %wd/%wu.  So the
> mentioned implementation is not really stressed yet... ;-)

That's all your fault ;-)

(Your commit
https://gcc.gnu.org/r12-3273-ge4cb3bb9ac11b4126ffa718287dd509a4b10a658
did remove the only user.)

> ../../gcc-trunk/gcc/fortran/resolve.cc: In function 'bool
> resolve_structure_cons(gfc_expr*, int)':
> ../../gcc-trunk/gcc/fortran/resolve.cc:1388:43: warning: unknown
> conversion type character 'w' in format [-Wformat=]
>      la, lb, comp->name, &cons->expr->where);
>                                            ^

That's only a warning. Have you tried whether it works at runtime?
My bet is that it does!

Question: Do you build with --disable-bootstrap ? Or do you do a proper bootstrap?

I am asking because:
* Here, it bootstraps *without* warnings/errors (I do a full bootstrap)
* GCC is bootstrapped with -Werror, i.e. I had expected an error and not a warning,
   while with --disable-bootstrap, the -Werror is not used as some random
   compiler may have additional (correct or bogus) warnings.
* %wd is only supported since GCC 12.
   The supported formats + the warning is bound to the compiler version,
   i.e. an older compiler does not support newer flags and, thus, warns for
   them when compiling. (But as the support depends on the current source,
   the compile-time warning of older compilers can be ignored.)

   * * *

Can you check & try again?  I don't mind getting a format warning with
GCC < GCC 12. But with GCC 12 compiled (either installed compiler or
when bootstrapping) it should compile without errors.

If you can confirm my suspicion, the patch LGTM.

Tobias

PS: I played around a bit. And with a GCC 12 bootstrap,
I get as expected an error (not a warning) for something unsupported (%Wd)
while %wd is supported. Additionally, I see a '|' in the output.

The "|" appeared with GCC 9. Thus, I wonder whether you compile w/o
bootstrapping with GCC 8?


../gcc/fortran/resolve.cc:1386:55: error: unknown conversion type character ‘W’ in format [-Werror=format=]
  1386 |               gfc_error ("Unequal character lengths (%Wd/%wd) for pointer "
       |                                                       ^

-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

  parent reply	other threads:[~2022-03-29  7:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-27 19:44 Harald Anlauf
2022-03-28 10:05 ` Tobias Burnus
2022-03-28 20:03   ` Harald Anlauf
2022-03-28 20:03     ` Harald Anlauf
2022-03-28 21:08     ` Harald Anlauf
2022-03-28 21:08       ` Harald Anlauf
2022-03-28 21:52       ` Joseph Myers
2022-03-29  7:14     ` Tobias Burnus [this message]
2022-03-29 18:48       ` Harald Anlauf
2022-03-29 18:48         ` Harald Anlauf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=89773980-593c-727a-28c9-d3304cd1aa78@codesourcery.com \
    --to=tobias@codesourcery.com \
    --cc=anlauf@gmx.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).