diff --git a/gcc/rust/typecheck/rust-hir-type-check-base.cc b/gcc/rust/typecheck/rust-hir-type-check-base.cc
index 7ff37c924..f966f002a 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-base.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-base.cc
@@ -522,6 +522,15 @@ TypeCheckBase::parse_repr_options (const AST::AttrVec &attrs, location_t locus)
 
 	  if (oparen == std::string::npos)
 	    {
+	      if (inline_option.compare ("align") == 0)
+		{
+		  rust_error_at (attr.get_locus (), ErrorCode::E0589,
+				 "invalid %<repr(align)%> attribute: %<align%> "
+				 "needs an argument");
+		  delete meta_items;
+		  break;
+		}
+
 	      is_pack = inline_option.compare ("packed") == 0;
 	      is_c = inline_option.compare ("C") == 0;
 	      is_integer = (inline_option.compare ("isize") == 0
@@ -571,6 +580,10 @@ TypeCheckBase::parse_repr_options (const AST::AttrVec &attrs, location_t locus)
 	    }
 	  else if (is_align)
 	    {
+	      if (value == 0 || (value & (value - 1)) != 0)
+		rust_error_at (
+		  attr.get_locus (), ErrorCode::E0589,
+		  "invalid %<repr(align)%> attribute: not a power of two");
 	      repr.repr_kind = TyTy::ADTType::ReprKind::ALIGN;
 	      repr.align = value;
 	    }
diff --git a/gcc/testsuite/rust/compile/invalid_repr_hint.rs b/gcc/testsuite/rust/compile/invalid_repr_hint.rs
index 7ac48a921..5e1af4d1c 100644
--- a/gcc/testsuite/rust/compile/invalid_repr_hint.rs
+++ b/gcc/testsuite/rust/compile/invalid_repr_hint.rs
@@ -6,7 +6,10 @@ struct Foo {
     x: i32,
 }
 
-#[repr(align)] // { dg-error "unrecognized representation hint" }
+#[repr(align)] // { dg-error "invalid .repr.align.. attribute: .align. needs an argument" }
 struct Bar {
     x: i32,
 }
+
+#[repr(align(3))] // { dg-error "invalid .repr.align.. attribute: not a power of two" }
+struct Baz {}
