File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -542,8 +542,8 @@ class InjectFaultCmd : public Cmd::StaticCmd
542542 .detach ();
543543 } else {
544544 if (!DoFault (args)) {
545- Print (" Usage: %s (drop | error | segfault | intdiv | floatdiv | unreachable "
546- " | exception | throw | terminate | abort | freeze <seconds>) [thread]" ,
545+ Print (" Usage: %s (drop | error | segfault | intdiv | floatinvalid | floatdiv | floatoverflow "
546+ " | unreachable | exception | throw | terminate | abort | freeze <seconds>) [thread]" ,
547547 args.Argv (0 ));
548548 }
549549 }
@@ -573,9 +573,15 @@ class InjectFaultCmd : public Cmd::StaticCmd
573573 } else if (how == " intdiv" ) {
574574 volatile int n = 0 ;
575575 n = n / n;
576+ } else if (how == " floatinvalid" ) {
577+ volatile float f = -1 .0f ;
578+ f = sqrtf (f);
576579 } else if (how == " floatdiv" ) {
577- volatile float x = 0 ;
578- x = x / x;
580+ volatile float f = 0 ;
581+ f = 1 / f;
582+ } else if (how == " floatoverflow" ) {
583+ volatile float f = std::numeric_limits<float >::max ();
584+ f = 2 * f;
579585 } else if (how == " unreachable" ) { // May print the usage string :)
580586 UNREACHABLE ();
581587 } else if (how == " exception" ) { // std::exception
You can’t perform that action at this time.
0 commit comments