bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#51882: Handle GCC's -fanalyzer output in M-x compile


From: Philip Kaludercic
Subject: bug#51882: Handle GCC's -fanalyzer output in M-x compile
Date: Tue, 23 Nov 2021 18:14:38 +0000

Mattias Engdegård <mattiase@acm.org> writes:

> Would it be possible to see a full example, with context, of the message 
> emitted by GCC?
> I would like to understand what, exactly, this regexp is supposed to
> be parsing. I've simplified the regexp in compile.el a little but want
> to be sure that I'm not making any mistakes.

Here is a snippet from a program I was working on:

--8<---------------cut here---------------start------------->8---
board.c:319:13: error: leak of 'move' [CWE-401] [-Werror=analyzer-malloc-leak]  
                                                             
  319 |      return (int16_t) changed;                                          
                                                             
      |             ^~~~~~~~~~~~~~~~~                                           
                                                             
  'place_stone': events 1-2                                                     
                                                             
    |                                                                           
                                                             
    |  387 | place_stone(struct Board *b, enum Stone s, struct Coord c)         
                                                            
    |      | ^~~~~~~~~~~                                                        
                                                            
    |      | |                                                                  
                                                             
    |      | (1) entry to 'place_stone'                                         
                                                            
    |  388 | {                                                                  
                                                             
    |  389 |      if (!valid_move(b, s, c)) {                                   
                                                             
    |      |         ~                                                          
                                                             
    |      |         |                                                          
                                                             
    |      |         (2) following 'false' branch...                            
                                                             
    |                                                                           
                                                             
  'place_stone': event 3                                                        
                                                             
    |                                                                           
                                                             
    |board.h:60:21:
    |   60 | #define I(b, C) ((C).y * (b)->width + (C).x)      /* coord -> 
index */                                                                        
                 
    |      |                  ~~~^~                                             
                                                             
    |      |                     |                                              
                                                             
    |      |                     (3) ...to here                                 
                                                             
board.h:61:34: note: in expansion of macro 'I'                                  
                                                            
    |   61 | #define stone_at(b, c) (b->board[I(b, c)])                         
                                                             
    |      |                                  ^                                 
                                                             
board.c:393:6: note: in expansion of macro 'stone_at'                           
                                                            
    |  393 |      stone_at(b, c) = s;                                           
                                                             
    |      |      ^~~~~~~~                                                      
                                                             
    |                                                                           
                                                             
  'place_stone': event 4                                                        
                                                             
    |                                                                           
                                                             
    |  395 |      return update_board(b, c);                                    
                                                             
    |      |             ^~~~~~~~~~~~~~~~~~                                     
                                                             
    |      |             |                                                      
                                                             
    |      |             (4) calling 'update_board' from 'place_stone'          
                                                             
    |                                                                           
                                                             
    +--> 'update_board': events 5-8                                             
                                                             
--8<---------------cut here---------------end--------------->8---

Notice how the

--8<---------------cut here---------------start------------->8---
    |board.h:60:21:
--8<---------------cut here---------------end--------------->8---

wouldn't be matched correctly using the previous regexp.

For reference, this is my GCC version:

gcc (Debian 10.2.1-6) 10.2.1 20210110
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

-- 
        Philip Kaludercic





reply via email to

[Prev in Thread] Current Thread [Next in Thread]