public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/63696] New: Alloc-dealloc-mismatch in ipa-icf.c
@ 2014-10-31  9:04 chefmax at gcc dot gnu.org
  2014-10-31  9:21 ` [Bug ipa/63696] " marxin at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: chefmax at gcc dot gnu.org @ 2014-10-31  9:04 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 63696
           Summary: Alloc-dealloc-mismatch in ipa-icf.c
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chefmax at gcc dot gnu.org
                CC: ygribov at gcc dot gnu.org
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu
             Build: x86_64-pc-linux-gnu

Created attachment 33850
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33850&action=edit
Trivial fix

Running ASan-boostrap on GCC 5, I ran into the problem:

$ cat /home/max/build/bootstrap-asan/x86_64-unknown-linux-gnu/libgcc/config.log

................................................................................

=================================================================
==22376==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new vs free)
on 0x602000002430
    #0 0x6b0cc9 in __interceptor_free
/home/max/workspace/downloads/gcc/libsanitizer/asan/asan_malloc_linux.cc:28
    #1 0x250a6c3 in ipa_icf::sem_function::~sem_function()
/home/max/workspace/downloads/gcc/gcc/ipa-icf.c:219
    #2 0x250a988 in ipa_icf::sem_function::~sem_function()
/home/max/workspace/downloads/gcc/gcc/ipa-icf.c:224
    #3 0x250aaa2 in ipa_icf::sem_item_optimizer::~sem_item_optimizer()
/home/max/workspace/downloads/gcc/gcc/ipa-icf.c:1286
    #4 0x2516271 in ipa_icf_driver
/home/max/workspace/downloads/gcc/gcc/ipa-icf.c:2346
    #5 0x2516271 in ipa_icf::pass_ipa_icf::execute(function*)
/home/max/workspace/downloads/gcc/gcc/ipa-icf.c:2391
    #6 0x121ebfb in execute_one_pass(opt_pass*)
/home/max/workspace/downloads/gcc/gcc/passes.c:2159
    #7 0x1220f46 in execute_ipa_pass_list(opt_pass*)
/home/max/workspace/downloads/gcc/gcc/passes.c:2553
    #8 0xab3316 in ipa_passes
/home/max/workspace/downloads/gcc/gcc/cgraphunit.c:2065
    #9 0xab3316 in symbol_table::compile()
/home/max/workspace/downloads/gcc/gcc/cgraphunit.c:2145
    #10 0xab80d7 in symbol_table::finalize_compilation_unit()
/home/max/workspace/downloads/gcc/gcc/cgraphunit.c:2298
    #11 0x72cad1 in c_write_global_declarations()
/home/max/workspace/downloads/gcc/gcc/c/c-decl.c:10779
    #12 0x142ab81 in compile_file
/home/max/workspace/downloads/gcc/gcc/toplev.c:581
    #13 0x636e4d in do_compile
/home/max/workspace/downloads/gcc/gcc/toplev.c:1988
    #14 0x636e4d in toplev::main(int, char**)
/home/max/workspace/downloads/gcc/gcc/toplev.c:2085
    #15 0x63a732 in main /home/max/workspace/downloads/gcc/gcc/main.c:38
    #16 0x2b44e29db76c in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2176c)
    #17 0x63b140 (/home/max/build/bootstrap-asan/gcc/cc1+0x63b140)

0x602000002430 is located 0 bytes inside of 16-byte region
[0x602000002430,0x602000002440)
allocated by thread T0 here:
    #0 0x6b1cc9 in operator new(unsigned long)
/home/max/workspace/downloads/gcc/libsanitizer/asan/asan_new_delete.cc:60
    #1 0x24fd320 in ipa_icf::sem_function::init()
/home/max/workspace/downloads/gcc/gcc/ipa-icf.c:736

SUMMARY: AddressSanitizer: alloc-dealloc-mismatch
/home/max/workspace/downloads/gcc/libsanitizer/asan/asan_malloc_linux.cc:28
__interceptor_free
==22376==HINT: if you don't care about these warnings you may set
ASAN_OPTIONS=alloc_dealloc_mismatch=0
==22376==ABORTING
configure:3398: $? = 1
configure:3586: checking for suffix of object files
configure:3608: /home/max/build/bootstrap-asan/./gcc/xgcc
-B/home/max/build/bootstrap-asan/./gcc/
-B/home/max/install/bootstrap-asan/x86_64-unknown-linux-gnu/bin/
-B/home/max/install/bootstrap-asan/x86_64-unknown-linux-gnu/lib/ -isystem
/home/max/install/bootstrap-asan/x86_64-unknown-linux-gnu/include -isystem
/home/max/install/bootstrap-asan/x86_64-unknown-linux-gnu/sys-include    -c -g
-O2  conftest.c >&5
=================================================================
==22386==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new vs free)
on 0x602000002430
    #0 0x6b0cc9 in __interceptor_free
/home/max/workspace/downloads/gcc/libsanitizer/asan/asan_malloc_linux.cc:28
    #1 0x250a6c3 in ipa_icf::sem_function::~sem_function()
/home/max/workspace/downloads/gcc/gcc/ipa-icf.c:219
    #2 0x250a988 in ipa_icf::sem_function::~sem_function()
/home/max/workspace/downloads/gcc/gcc/ipa-icf.c:224
    #3 0x250aaa2 in ipa_icf::sem_item_optimizer::~sem_item_optimizer()
/home/max/workspace/downloads/gcc/gcc/ipa-icf.c:1286
    #4 0x2516271 in ipa_icf_driver
/home/max/workspace/downloads/gcc/gcc/ipa-icf.c:2346
    #5 0x2516271 in ipa_icf::pass_ipa_icf::execute(function*)
/home/max/workspace/downloads/gcc/gcc/ipa-icf.c:2391
    #6 0x121ebfb in execute_one_pass(opt_pass*)
/home/max/workspace/downloads/gcc/gcc/passes.c:2159
    #7 0x1220f46 in execute_ipa_pass_list(opt_pass*)
/home/max/workspace/downloads/gcc/gcc/passes.c:2553
    #8 0xab3316 in ipa_passes
/home/max/workspace/downloads/gcc/gcc/cgraphunit.c:2065
    #9 0xab3316 in symbol_table::compile()
/home/max/workspace/downloads/gcc/gcc/cgraphunit.c:2145
    #10 0xab80d7 in symbol_table::finalize_compilation_unit()
/home/max/workspace/downloads/gcc/gcc/cgraphunit.c:2298
    #11 0x72cad1 in c_write_global_declarations()
/home/max/workspace/downloads/gcc/gcc/c/c-decl.c:10779
    #12 0x142ab81 in compile_file
/home/max/workspace/downloads/gcc/gcc/toplev.c:581
    #13 0x636e4d in do_compile
/home/max/workspace/downloads/gcc/gcc/toplev.c:1988
    #14 0x636e4d in toplev::main(int, char**)
/home/max/workspace/downloads/gcc/gcc/toplev.c:2085
    #15 0x63a732 in main /home/max/workspace/downloads/gcc/gcc/main.c:38
    #16 0x2b02929fb76c in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2176c)
    #17 0x63b140 (/home/max/build/bootstrap-asan/gcc/cc1+0x63b140)


$ ~/build/bootstrap-asan/gcc$ ./xgcc -v
Using built-in specs.
COLLECT_GCC=./xgcc
Target: x86_64-unknown-linux-gnu
Configured with: /home/max/workspace/downloads/gcc/configure --enable-multilib
--enable-checking --target=x86_64-unknown-linux-gnu
--host=x86_64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu
--prefix=/home/max/install/bootstrap-asan --enable-bootstrap
--with-build-config=bootstrap-asan
Thread model: posix
gcc version 5.0.0 20141030 (experimental) (GCC) 

Trivial fix seems to resolve the issue.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug ipa/63696] Alloc-dealloc-mismatch in ipa-icf.c
  2014-10-31  9:04 [Bug ipa/63696] New: Alloc-dealloc-mismatch in ipa-icf.c chefmax at gcc dot gnu.org
@ 2014-10-31  9:21 ` marxin at gcc dot gnu.org
  2014-10-31 10:09 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2014-10-31  9:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Thank you Maxim for the fix, please send it to patches mailing list.

Martin
>From gcc-bugs-return-465458-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Oct 31 09:21:36 2014
Return-Path: <gcc-bugs-return-465458-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 5648 invoked by alias); 31 Oct 2014 09:21:36 -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 5587 invoked by uid 48); 31 Oct 2014 09:21:33 -0000
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug sanitizer/63697] -fsanitize=undefined doesn't detect some subtraction overflows
Date: Fri, 31 Oct 2014 09:22:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: sanitizer
X-Bugzilla-Version: 4.9.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: mpolacek at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on everconfirmed
Message-ID: <bug-63697-4-FEYgMfYNcg@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-63697-4@http.gcc.gnu.org/bugzilla/>
References: <bug-63697-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: 2014-10/txt/msg02479.txt.bz2
Content-length: 483

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-10-31
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug ipa/63696] Alloc-dealloc-mismatch in ipa-icf.c
  2014-10-31  9:04 [Bug ipa/63696] New: Alloc-dealloc-mismatch in ipa-icf.c chefmax at gcc dot gnu.org
  2014-10-31  9:21 ` [Bug ipa/63696] " marxin at gcc dot gnu.org
@ 2014-10-31 10:09 ` rguenth at gcc dot gnu.org
  2014-10-31 11:08 ` chefmax at gcc dot gnu.org
  2014-11-06  8:29 ` chefmax at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-10-31 10:09 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-10-31
     Ever confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed - valgrind also complains about this.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug ipa/63696] Alloc-dealloc-mismatch in ipa-icf.c
  2014-10-31  9:04 [Bug ipa/63696] New: Alloc-dealloc-mismatch in ipa-icf.c chefmax at gcc dot gnu.org
  2014-10-31  9:21 ` [Bug ipa/63696] " marxin at gcc dot gnu.org
  2014-10-31 10:09 ` rguenth at gcc dot gnu.org
@ 2014-10-31 11:08 ` chefmax at gcc dot gnu.org
  2014-11-06  8:29 ` chefmax at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: chefmax at gcc dot gnu.org @ 2014-10-31 11:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Maxim Ostapenko <chefmax at gcc dot gnu.org> ---
Author: chefmax
Date: Fri Oct 31 10:53:36 2014
New Revision: 216954

URL: https://gcc.gnu.org/viewcvs?rev=216954&root=gcc&view=rev
Log:
gcc/

2014-10-31  Max Ostapenko  <m.ostapenko@partner.samsung.com>

        PR ipa/63696
        * ipa-icf.c (sem_function::~sem_function): Change free to delete to
avoid
        alloc-dealloc mismatch with new, called in ipa_icf::sem_function::init.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/ipa-icf.c


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug ipa/63696] Alloc-dealloc-mismatch in ipa-icf.c
  2014-10-31  9:04 [Bug ipa/63696] New: Alloc-dealloc-mismatch in ipa-icf.c chefmax at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-10-31 11:08 ` chefmax at gcc dot gnu.org
@ 2014-11-06  8:29 ` chefmax at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: chefmax at gcc dot gnu.org @ 2014-11-06  8:29 UTC (permalink / raw)
  To: gcc-bugs

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

Maxim Ostapenko <chefmax at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Maxim Ostapenko <chefmax at gcc dot gnu.org> ---
Fixed by r216954.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-11-06  8:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-31  9:04 [Bug ipa/63696] New: Alloc-dealloc-mismatch in ipa-icf.c chefmax at gcc dot gnu.org
2014-10-31  9:21 ` [Bug ipa/63696] " marxin at gcc dot gnu.org
2014-10-31 10:09 ` rguenth at gcc dot gnu.org
2014-10-31 11:08 ` chefmax at gcc dot gnu.org
2014-11-06  8:29 ` chefmax at gcc dot gnu.org

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).