Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 517736 - gcc-4.8.2 segfault nth element
Summary: gcc-4.8.2 segfault nth element
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-22 00:17 UTC by Eddie Parker
Modified: 2014-07-22 00:33 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to fix segfault. (gcc-4.8.2-fix-nth-element-segfault.patch.txt,265.97 KB, text/plain)
2014-07-22 00:17 UTC, Eddie Parker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eddie Parker 2014-07-22 00:17:23 UTC
Created attachment 381304 [details]
Patch to fix segfault.

I had an issue that was discovered to be a bug in gcc (see here: https://github.com/openscad/openscad/issues/882).  Applying the patch mentioned here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58800 fixes it.

I've uploaded the patch as applied against the ebuild - it fixes my issue locally.

Copying and pasting my original bug report:

Running Openscad on a very simple model yields me a segmentation fault:

Model:

union()
{
    cylinder(r=19,h=10, center=true);
}
Command line:

openscad -o test.stl ACylinder.scad
Running in gdb with symbols:

GNU gdb (Gentoo 7.7.1 p1) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from openscad...done.
(gdb) run
Starting program: /usr/bin/openscad -o test.stl ACylinder.scad
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
operator< (q=..., this=<error reading variable: Cannot access memory at address 0x0>) at /usr/include/CGAL/GMP/Gmpq_type.h:194
194       bool operator< (const Gmpq &q) const { return mpq_cmp(this->mpq(), q.mpq()) < 0; }
Full backtrace:

#0  operator< (q=..., this=<error reading variable: Cannot access memory at address 0x0>) at /usr/include/CGAL/GMP/Gmpq_type.h:194
#1  operator() (this=<optimized out>, y=..., x=<error reading variable: Cannot access memory at address 0x0>) at /usr/include/CGAL/Real_embeddable_traits.h:143
#2  compare<CGAL::Gmpq, CGAL::Gmpq> (b=..., a=<error reading variable: Cannot access memory at address 0x0>) at /usr/include/CGAL/number_utils.h:234
#3  operator() (this=<optimized out>, q=..., p=...) at /usr/include/CGAL/Cartesian/function_objects.h:772
#4  compare_y<CGAL::Cartesian<CGAL::Gmpq> > (k=..., q=..., p=...) at /usr/include/CGAL/Kernel/global_functions_internal_3.h:486
#5  compare_y<CGAL::Cartesian<CGAL::Gmpq> > (q=..., p=...) at /usr/include/CGAL/Kernel/global_functions_3.h:424
#6  CGAL::K3_tree<CGAL::SNC_k3_tree_traits<CGAL::SNC_decorator<CGAL::SNC_structure<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool> > > >::Smaller_than<CGAL::Cartesian<CGAL::Gmpq>, CGAL::Object, CGAL::internal::In_place_list_iterator<CGAL::SNC_in_place_list_sm<CGAL::SNC_sphere_map<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool> >, std::allocator<CGAL::SNC_in_place_list_sm<CGAL::SNC_sphere_map<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool> > > >, int>::operator() (this=0x7fffffffa6e0, o1=..., o2=...) at /usr/include/CGAL/Nef_3/K3_tree.h:115
#7  0x00000000005febb8 in __unguarded_partition<__gnu_cxx::__normal_iterator<CGAL::Object*, std::vector<CGAL::Object> >, CGAL::Object, CGAL::K3_tree<CGAL::SNC_k3_tree_traits<CGAL::SNC_decorator<CGAL::SNC_structure<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool> > > >::Smaller_than<CGAL::Cartesian<CGAL::Gmpq>, CGAL::Object, CGAL::internal::In_place_list_iterator<CGAL::SNC_in_place_list_sm<CGAL::SNC_sphere_map<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool> >, std::allocator<CGAL::SNC_in_place_list_sm<CGAL::SNC_sphere_map<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool> > > >, int> > (
    __comp=..., __pivot=..., __last=..., __first=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include/g++-v4.8/bits/stl_algo.h:2263
#8  __unguarded_partition_pivot<__gnu_cxx::__normal_iterator<CGAL::Object*, std::vector<CGAL::Object> >, CGAL::K3_tree<CGAL::SNC_k3_tree_traits<CGAL::SNC_decorator<CGAL::SNC_structure<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool> > > >::Smaller_than<CGAL::Cartesian<CGAL::Gmpq>, CGAL::Object, CGAL::internal::In_place_list_iterator<CGAL::SNC_in_place_list_sm<CGAL::SNC_sphere_map<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool> >, std::allocator<CGAL::SNC_in_place_list_sm<CGAL::SNC_sphere_map<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool> > > >, int> > (__comp=..., __last=..., __first=...)
    at /usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include/g++-v4.8/bits/stl_algo.h:2296
#9  std::__introselect<__gnu_cxx::__normal_iterator<CGAL::Object*, std::vector<CGAL::Object, std::allocator<CGAL::Object> > >, long, CGAL::K3_tree<CGAL::SNC_k3_tree_traits<CGAL::SNC_decorator<CGAL::SNC_structure<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool> > > >::Smaller_than<CGAL::Cartesian<CGAL::Gmpq>, CGAL::Object, CGAL::internal::In_place_list_iterator<CGAL::SNC_in_place_list_sm<CGAL::SNC_sphere_map<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool> >, std::allocator<CGAL::SNC_in_place_list_sm<CGAL::SNC_sphere_map<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool> > > >, int> > (
    __first=..., __nth=..., __nth@entry=..., __last=..., __depth_limit=3, __comp=..., __comp@entry=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include/g++-v4.8/bits/stl_algo.h:2394
#10 0x00000000005fedca in nth_element<__gnu_cxx::__normal_iterator<CGAL::Object*, std::vector<CGAL::Object> >, CGAL::K3_tree<CGAL::SNC_k3_tree_traits<CGAL::SNC_decorator<CGAL::SNC_structure<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool> > > >::Smaller_than<CGAL::Cartesian<CGAL::Gmpq>, CGAL::Object, CGAL::internal::In_place_list_iterator<CGAL::SNC_in_place_list_sm<CGAL::SNC_sphere_map<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool> >, std::allocator<CGAL::SNC_in_place_list_sm<CGAL::SNC_sphere_map<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool> > > >, int> > (__comp=..., __last=...,
    __nth=..., __first=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include/g++-v4.8/bits/stl_algo.h:5417
#11 CGAL::K3_tree<CGAL::SNC_k3_tree_traits<CGAL::SNC_decorator<CGAL::SNC_structure<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool> > > >::construct_splitting_plane<int> (this=this@entry=0xb00f90,
    start=..., end=..., end@entry=..., median=..., depth=depth@entry=4) at /usr/include/CGAL/Nef_3/K3_tree.h:1246
#12 0x00000000005ff034 in CGAL::K3_tree<CGAL::SNC_k3_tree_traits<CGAL::SNC_decorator<CGAL::SNC_structure<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool> > > >::build_kdtree<int> (
    this=this@entry=0xb00f90, O=..., v_end=..., depth=depth@entry=4, parent=parent@entry=0xb10e00, non_efective_splits=non_efective_splits@entry=0) at /usr/include/CGAL/Nef_3/K3_tree.h:1130
#13 0x00000000005ff93e in CGAL::K3_tree<CGAL::SNC_k3_tree_traits<CGAL::SNC_decorator<CGAL::SNC_structure<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool> > > >::build_kdtree<int> (
    this=this@entry=0xb00f90, O=..., v_end=..., depth=depth@entry=3, parent=parent@entry=0xb40d40, non_efective_splits=0, non_efective_splits@entry=1) at /usr/include/CGAL/Nef_3/K3_tree.h:1187
#14 0x00000000005ff93e in CGAL::K3_tree<CGAL::SNC_k3_tree_traits<CGAL::SNC_decorator<CGAL::SNC_structure<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool> > > >::build_kdtree<int> (
    this=this@entry=0xb00f90, O=..., v_end=..., depth=depth@entry=2, parent=parent@entry=0xb412e0, non_efective_splits=1, non_efective_splits@entry=0) at /usr/include/CGAL/Nef_3/K3_tree.h:1187
#15 0x00000000005ff90e in CGAL::K3_tree<CGAL::SNC_k3_tree_traits<CGAL::SNC_decorator<CGAL::SNC_structure<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool> > > >::build_kdtree<int> (
    this=this@entry=0xb00f90, O=..., v_end=..., depth=depth@entry=1, parent=parent@entry=0xb01670, non_efective_splits=non_efective_splits@entry=0) at /usr/include/CGAL/Nef_3/K3_tree.h:1186
#16 0x00000000005ff93e in CGAL::K3_tree<CGAL::SNC_k3_tree_traits<CGAL::SNC_decorator<CGAL::SNC_structure<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool> > > >::build_kdtree<int> (
    this=this@entry=0xb00f90, O=..., v_end=..., depth=depth@entry=0, parent=parent@entry=0x0, non_efective_splits=non_efective_splits@entry=0) at /usr/include/CGAL/Nef_3/K3_tree.h:1187
#17 0x00000000005ffbff in CGAL::K3_tree<CGAL::SNC_k3_tree_traits<CGAL::SNC_decorator<CGAL::SNC_structure<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool> > > >::K3_tree (this=0xb00f90, objects=...,
    v_end=...) at /usr/include/CGAL/Nef_3/K3_tree.h:867
#18 0x00000000005fffa9 in CGAL::SNC_point_locator_by_spatial_subdivision<CGAL::SNC_decorator<CGAL::SNC_structure<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool> > >::initialize (this=0xa824e0,
    W=<optimized out>) at /usr/include/CGAL/Nef_3/SNC_point_locator.h:415
#19 0x00000000005f31e3 in CGAL::SNC_external_structure_base<int, CGAL::SNC_structure<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool> >::create_volumes (this=this@entry=0x7fffffffbcc0)
    at /usr/include/CGAL/Nef_3/SNC_external_structure.h:801
#20 0x00000000005f3e7d in create_volumes (this=0x7fffffffbcc0) at /usr/include/CGAL/Nef_3/SNC_external_structure.h:1236
#21 CGAL::SNC_external_structure<CGAL::SNC_indexed_items, CGAL::SNC_structure<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool> >::build_external_structure (this=this@entry=0x7fffffffbcc0)
    at /usr/include/CGAL/Nef_3/SNC_external_structure.h:1294
#22 0x00000000005f491b in build_external_structure (this=0xa61e40) at /usr/include/CGAL/Nef_polyhedron_3.h:360
#23 CGAL::Nef_polyhedron_3<CGAL::Cartesian<CGAL::Gmpq>, CGAL::SNC_indexed_items, bool>::Nef_polyhedron_3<CGAL::Cartesian<CGAL::Gmpq>, CGAL::Polyhedron_items_3, CGAL::HalfedgeDS_default, std::allocator<int> > (
    this=0xa61e40, P=...) at /usr/include/CGAL/Nef_polyhedron_3.h:568
#24 0x00000000005b20d9 in CGALEvaluator::evaluateCGALMesh (this=this@entry=0x7fffffffcb00, ps=...) at src/CGALEvaluator.cc:693
#25 0x00000000005b2642 in CGALEvaluator::visit (this=0x7fffffffcb00, state=..., node=...) at src/CGALEvaluator.cc:363
#26 0x00000000004b3a5f in Traverser::traverse (this=this@entry=0x7fffffffc680, node=..., state=...) at src/traverser.cc:41
#27 0x00000000004b39c6 in Traverser::traverse (this=this@entry=0x7fffffffc680, node=..., state=...) at src/traverser.cc:30
#28 0x00000000004b39c6 in Traverser::traverse (this=this@entry=0x7fffffffc680, node=..., state=...) at src/traverser.cc:30
#29 0x00000000004b3b87 in Traverser::execute (this=this@entry=0x7fffffffc680) at src/traverser.cc:11
#30 0x00000000005abcdd in CGALEvaluator::evaluateCGALMesh (this=this@entry=0x7fffffffcb00, node=...) at src/CGALEvaluator.cc:44
#31 0x00000000005523b1 in cmdline (deps_output_file=deps_output_file@entry=0x0, filename=..., camera=..., output_file=output_file@entry=0xa3a928 "test.stl", original_path=...,
    renderer=renderer@entry=Render::OPENCSG, argc=argc@entry=4, argv=argv@entry=0x7fffffffe4f8) at src/openscad.cc:348
#32 0x0000000000434413 in main (argc=4, argv=0x7fffffffe4f8) at src/openscad.cc:712
It's a Funtoo system, running gcc 4.8.2, under the 3.10.11-1 debian kernel.

Let me know if you need any other information.
Comment 1 Alex Xu (Hello71) 2014-07-22 00:33:47 UTC
The fixed versions are already in the tree. If you are running mixed, you must upgrade to the latest ~arch version.