aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-12-15 20:33:33 +0000
committerPhilip Herron <philip.herron@embecosm.com>2021-12-15 22:28:12 +0000
commit24dd9a6aef8493a46e61735b17c9c26bd7c164ef (patch)
treed14617885960c60ecb777993479bbe967302ec02 /gcc/rust/backend
parent310968874db1902084012cf767ad0b6e93f028c2 (diff)
downloadgcc-24dd9a6aef8493a46e61735b17c9c26bd7c164ef.zip
gcc-24dd9a6aef8493a46e61735b17c9c26bd7c164ef.tar.gz
gcc-24dd9a6aef8493a46e61735b17c9c26bd7c164ef.tar.bz2
BugFix bad range in typechecking of enum ADTTypes
The type checking over the fields of each variant was using the wrong iterator causing the type checker to go out of bound in the case where there were more variants than fields within the variant. ``` terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 2) >= this->size() (which is 1) Program received signal SIGABRT, Aborted. __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt ... -7 0x000000000119dcfc in std::vector<Rust::TyTy::StructFieldType*, std::allocator<Rust::TyTy::StructFieldType*> >::_M_range_check (this=0x426fb90, __n=2) at /usr/include/c++/9/bits/stl_vector.h:1070 -8 0x000000000119a2e5 in std::vector<Rust::TyTy::StructFieldType*, std::allocator<Rust::TyTy::StructFieldType*> >::at (this=0x426fb90, __n=2) at /usr/include/c++/9/bits/stl_vector.h:1091 -9 0x000000000117ead7 in Rust::TyTy::VariantDef::get_field_at_index (this=0x426fb60, index=2) at ../../gccrs/gcc/rust/typecheck/rust-tyty.h:1080 -10 0x00000000011c7523 in Rust::TyTy::ADTRules::visit (this=0x7fffffffce90, type=...) at ../../gccrs/gcc/rust/typecheck/rust-tyty-rules.h:1050 -11 0x00000000011b52a4 in Rust::TyTy::ADTType::accept_vis (this=0x4271120, vis=...) at ../../gccrs/gcc/rust/typecheck/rust-tyty.cc:642 -12 0x00000000011c2d80 in Rust::TyTy::BaseRules::unify (this=0x7fffffffce90, other=0x4271120) at ../../gccrs/gcc/rust/typecheck/rust-tyty-rules.h:85 -13 0x00000000011b552e in Rust::TyTy::ADTType::unify (this=0x426fe30, other=0x4271120) at ../../gccrs/gcc/rust/typecheck/rust-tyty.cc:670 -14 0x000000000118e49f in Rust::Resolver::TypeCheckExpr::visit (this=0x7fffffffd070, expr=...) at ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-expr.h:1302 ```
Diffstat (limited to 'gcc/rust/backend')
0 files changed, 0 insertions, 0 deletions