Rust-GCC / gccrs

GCC Front-End for Rust

Home Page:https://rust-gcc.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Safe guard InlineAsm-related structs

badumbatish opened this issue · comments

The current InlineAsm structs have a lot of constructors where we permit the intialization of nullptr and then we would have to test to see if the pointer is nullptr before performing clone_expr (and not to mention other pointer related operation)

Please preview Arthur's review in this PR.

if expr cannot be null then it would be nice to add more assertions to this struct (but in another PR)

  1. remove the empty constructor, as that will set expr to nullptr and thus create an invalid InOut
  2. in the full constructor on line 4850, rust_assert(expr) to ensure that expr is not null
  3. because expr is not null, remove the if (other.expr) checks in both the copy constructor and operator= overload

Originally posted by @CohenArthur in #2982 (comment)