Bug 63323 - "confused by earlier errors, bailing out" with no other errors
Summary: "confused by earlier errors, bailing out" with no other errors
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.9.1
: P3 normal
Target Milestone: 4.9.2
Assignee: Marek Polacek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-22 01:28 UTC by Tavian Barnes
Modified: 2014-09-22 11:29 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 5.0
Known to fail: 4.9.0, 4.9.1
Last reconfirmed: 2014-09-22 00:00:00


Attachments
Preprocessed source (87.63 KB, text/plain)
2014-09-22 01:28 UTC, Tavian Barnes
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tavian Barnes 2014-09-22 01:28:36 UTC
Created attachment 33529 [details]
Preprocessed source

The following file gives a "confused by earlier errors, bailing out" error message, with no previous errors printed, when compiled with -fsanitize=undefined:

$ cat confused.cpp
#include <memory>
#include <map>

int
main()
{
  std::unique_ptr<int> ptr{new int};
  std::map<int, std::unique_ptr<int>> map;
  map.insert({0, std::move(ptr)});
  return 0;
}
$ g++ -std=c++11 -fsanitize=undefined confused.cpp
‘
/usr/include/c++/4.9.1/ext/new_allocator.h:120: confused by earlier errors, bailing out

Without the -fsanitize=undefined, it points to the actual error, which is fixed by using std::make_pair instead of a braced initializer as the argument to insert().
Comment 1 Jonathan Wakely 2014-09-22 08:46:51 UTC
Confirmed. Trunk prints the full error though.
Comment 2 Jakub Jelinek 2014-09-22 08:48:38 UTC
This is a dup of PR61272 , Marek, can you please apply your PR61272 patch to 4.9 branch too?  Thanks.
Comment 3 Marek Polacek 2014-09-22 08:52:38 UTC
On it.
Comment 4 Marek Polacek 2014-09-22 11:28:26 UTC
Author: mpolacek
Date: Mon Sep 22 11:27:54 2014
New Revision: 215459

URL: https://gcc.gnu.org/viewcvs?rev=215459&root=gcc&view=rev
Log:
	PR c++/63323
	* ubsan.c (is_ubsan_builtin_p): Turn assert into a condition.

	* g++.dg/ubsan/pr61272.C: New test.

Added:
    branches/gcc-4_9-branch/gcc/testsuite/g++.dg/ubsan/pr61272.C
Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_9-branch/gcc/ubsan.c
Comment 5 Marek Polacek 2014-09-22 11:29:34 UTC
Should be fixed.