public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/54224] Warn for unused internal procedures
Date: Sun, 13 Sep 2015 15:52:00 -0000	[thread overview]
Message-ID: <bug-54224-4-DFmOKcIBiu@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-54224-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #24 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Dominique d'Humieres from comment #23)
> > I'm not a Fortran dev, but I would humbly suggest to add this testcase
> > to the regression testsuite before closing the bug.
> 
> OK. REOPENED.
> 
> > Also:
> >
> > > pr54224_3.f90:6:0:
> > > 
> > >     subroutine s2
> > > ^
> >
> > You will get a more precise column info (and better location for '^')
> > if Fortran gives a more precise DECL_SOURCE_LOCATION() when generating this tree.
> 
> Could you please elaborate?

I don't know the Fortran FE that well, but at some moment it creates this tree
and it sets DECL_SOURCE_LOCATION(). Probably based on some loc->lb->location.
However, that only contains line number info because Fortran does not use
libcpp/line-map.c for tracking column numbers (it only creates new locations
for line changes).

Fully using line-map.c in Fortran is likely to be a lot of work, but it could
mean getting precise macro locations
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53934#c2) and remove some of the
duplication between libcpp and Fortran (tokenizer, file inclusion, etc.)

Nonetheless, as a work-around, you could use:

        unsigned int offset = loc->nextc - loc->lb->line;
        location = linemap_position_for_loc_and_offset (line_table,
                                                        loc->lb->location,
                                                        offset));

to create a new location_t with the correct column number and use that for the
tree it creates.
>From gcc-bugs-return-497116-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Sep 13 15:57:45 2015
Return-Path: <gcc-bugs-return-497116-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 69577 invoked by alias); 13 Sep 2015 15:57:45 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 69515 invoked by uid 48); 13 Sep 2015 15:57:41 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/56659] Segfault due to missing libcpp error handler for "gfortran -cpp"
Date: Sun, 13 Sep 2015 15:57:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.8.0
X-Bugzilla-Keywords: ice-on-invalid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-56659-4-8fqxBdtv4g@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-56659-4@http.gcc.gnu.org/bugzilla/>
References: <bug-56659-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-09/txt/msg01094.txt.bz2
Content-length: 1466

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #0)
> Reported by Paul Kapinos at fortran@gcc,
> http://thread.gmane.org/gmane.comp.gcc.fortran/40495
> http://gcc.gnu.org/ml/fortran/2013-03/msg00083.html
> 
> The problem is that libcpp calls an error handler, which is not set in f951.
> 
> 
> Namely,   pfile->cb.error == NULL  but should be point to a function; it has
> the the prototype:
>  bool (*)(cpp_reader *, int, int, source_location, unsigned int, const char
> *,
>           va_list *) 
> C/C++ use:
>    in c-opts.c: "cb->error = c_cpp_error;"
> the function is declared in c-family/c-common.c.

Now that Fortran uses the common diagnostics machinery, it should be possible
to either move this function to common code or create a duplicate in the
Fortran FE.

(Even better would be to convert the common diagnostics machinery to a library
and make libcpp depend on it, which will avoid all these conversions from/to
libcpp/FE enums since libcpp could use directly the same diagnostic enums as
the rest of the compiler)
>From gcc-bugs-return-497117-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Sep 13 16:00:20 2015
Return-Path: <gcc-bugs-return-497117-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 77299 invoked by alias); 13 Sep 2015 16:00:20 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 77224 invoked by uid 48); 13 Sep 2015 16:00:16 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/56659] Segfault due to missing libcpp error handler for "gfortran -cpp"
Date: Sun, 13 Sep 2015 16:00:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.8.0
X-Bugzilla-Keywords: ice-on-invalid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: dependson
Message-ID: <bug-56659-4-oYUon8z535@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-56659-4@http.gcc.gnu.org/bugzilla/>
References: <bug-56659-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-09/txt/msg01095.txt.bz2
Content-length: 866

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |62226

--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #2)
> Now that Fortran uses the common diagnostics machinery, it should be
> possible to either move this function to common code or create a duplicate
> in the Fortran FE.

For this function to work, CPP options used by Fortran must be specially
encoded in the *.opt file. See bug 62226.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62226
[Bug 62226] Encode CPP options in lang.opt
>From gcc-bugs-return-497118-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Sep 13 16:13:22 2015
Return-Path: <gcc-bugs-return-497118-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 112451 invoked by alias); 13 Sep 2015 16:13:21 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 112394 invoked by uid 48); 13 Sep 2015 16:13:18 -0000
From: "kargl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/67538] ICE with invalid source allocation
Date: Sun, 13 Sep 2015 16:13:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: kargl at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-67538-4-98b3FXRLps@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-67538-4@http.gcc.gnu.org/bugzilla/>
References: <bug-67538-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-09/txt/msg01096.txt.bz2
Content-length: 801

https://gcc.gnu.org/bugzilla/show_bug.cgi?idg538

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #2 from kargl at gcc dot gnu.org ---
(In reply to Dominique d'Humieres from comment #1)
> > The following code is invalid since the array dimension is missing,
> > but since it is an ICE I am reporting it.
>
> This is valid since F2003 (implemented recently by Andre Vehreschild), but
> it should not give an ICE.

Are you sure?

There is no array spec.

real, allocatabe :: x(:)  ! Rank 1
real y
y = 42                    ! Rank 0
allocate(x , source=y)

What are the ubound and lbound of x?


      parent reply	other threads:[~2015-09-13 15:52 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-10 15:44 [Bug middle-end/54224] New: [4.8 Regression] Bogus -Wunused-function warning with static function burnus at gcc dot gnu.org
2012-08-11  9:03 ` [Bug middle-end/54224] " burnus at gcc dot gnu.org
2012-08-15 12:39 ` burnus at gcc dot gnu.org
2012-08-15 13:04 ` burnus at gcc dot gnu.org
2012-08-15 18:30 ` [Bug middle-end/54224] [4.8 Regression] " janus at gcc dot gnu.org
2012-08-16  9:57 ` burnus at gcc dot gnu.org
2012-08-16 11:07 ` rguenth at gcc dot gnu.org
2012-08-21  8:49 ` burnus at gcc dot gnu.org
2012-09-15 17:42 ` [Bug fortran/54224] " janus at gcc dot gnu.org
2012-09-15 17:48 ` burnus at gcc dot gnu.org
2012-09-15 18:26 ` janus at gcc dot gnu.org
2012-09-19 14:25 ` rguenth at gcc dot gnu.org
2012-10-19 17:15 ` janus at gcc dot gnu.org
2012-10-19 17:23 ` janus at gcc dot gnu.org
2012-10-19 17:49 ` janus at gcc dot gnu.org
2012-10-19 17:54 ` [Bug fortran/54224] Warn for unused (private) module variables and internal procedures janus at gcc dot gnu.org
2012-10-20 21:18 ` janus at gcc dot gnu.org
2013-03-22 14:45 ` jakub at gcc dot gnu.org
2013-05-31 10:59 ` jakub at gcc dot gnu.org
2013-08-19 21:18 ` janus at gcc dot gnu.org
2013-08-19 21:22 ` [Bug fortran/54224] Warn for unused " janus at gcc dot gnu.org
2013-10-16  9:51 ` jakub at gcc dot gnu.org
2015-06-22 14:26 ` rguenth at gcc dot gnu.org
2015-09-13 13:45 ` dominiq at lps dot ens.fr
2015-09-13 15:04 ` manu at gcc dot gnu.org
2015-09-13 15:24 ` dominiq at lps dot ens.fr
2015-09-13 15:52 ` manu at gcc dot gnu.org [this message]

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=bug-54224-4-DFmOKcIBiu@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).