diff --git a/compiler/noirc_evaluator/src/ssa/opt/remove_enable_side_effects.rs b/compiler/noirc_evaluator/src/ssa/opt/remove_enable_side_effects.rs index 0dfe436692e..6212b46d7c0 100644 --- a/compiler/noirc_evaluator/src/ssa/opt/remove_enable_side_effects.rs +++ b/compiler/noirc_evaluator/src/ssa/opt/remove_enable_side_effects.rs @@ -110,11 +110,9 @@ fn responds_to_side_effects_var(dfg: &DataFlowGraph, instruction: &Instruction) dfg.type_of_value(binary.lhs).is_unsigned() } BinaryOp::Div | BinaryOp::Mod => { - if let Some(rhs) = dfg.get_numeric_constant(binary.rhs) { - rhs == FieldElement::zero() - } else { - true - } + // Even with non zero rhs, division and modulo respond to side effects because they + // use non-deterministic outputs which will be affected by the side effects var. + true } _ => false, }, diff --git a/test_programs/execution_success/regression_8261/Nargo.toml b/test_programs/execution_success/regression_8261/Nargo.toml new file mode 100644 index 00000000000..0fc086993d4 --- /dev/null +++ b/test_programs/execution_success/regression_8261/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "regression_8261" +type = "bin" +authors = [""] + +[dependencies] diff --git a/test_programs/execution_success/regression_8261/Prover.toml b/test_programs/execution_success/regression_8261/Prover.toml new file mode 100644 index 00000000000..133555e7971 --- /dev/null +++ b/test_programs/execution_success/regression_8261/Prover.toml @@ -0,0 +1,29 @@ +a = true +b = [ + [ + true, + false, + ], + [ + true, + true, + ], + "\u0014w", + [ + "0x000000000000000000000000000000000000000000000000000000000000dd8e", + "0x00000000000000000000000000000000000000000000000000000000000002cc", + ], + "0x000000000000000000000000000000000000000000000000000000000000137c", +] +c = [ + [ + "0x1eac91250e5e424f9c8b3eb451e0b343131fcf4342053cfad6337e7ca1350adb", + "", + false, + false, + ], + [ + "0x000000000000000000000000000000000000000000000000000000000000c456", + "\u001B\"", + ], +] \ No newline at end of file diff --git a/test_programs/execution_success/regression_8261/src/main.nr b/test_programs/execution_success/regression_8261/src/main.nr new file mode 100644 index 00000000000..3e7f029925b --- /dev/null +++ b/test_programs/execution_success/regression_8261/src/main.nr @@ -0,0 +1,16 @@ +fn main( + a: bool, + b: ([bool; 2], [bool; 2], str<2>, (u16, u16), u16), + c: ((Field, str<0>, bool, bool), (u16, str<2>)), +) -> pub u16 { + b.4 + % if c.0.2 { + b.3.0 + } else { + if (!a) { + 37995 + } else { + (b.3.1 % 64485) + } + } +} diff --git a/test_programs/execution_success/regression_8261/stdout.txt b/test_programs/execution_success/regression_8261/stdout.txt new file mode 100644 index 00000000000..bb180247442 --- /dev/null +++ b/test_programs/execution_success/regression_8261/stdout.txt @@ -0,0 +1 @@ +[regression_8261] Circuit output: Field(692) \ No newline at end of file diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8261/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8261/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap new file mode 100644 index 00000000000..6c7f581c86f --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8261/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap @@ -0,0 +1,131 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: artifact +--- +{ + "noir_version": "[noir_version]", + "hash": "[hash]", + "abi": { + "parameters": [ + { + "name": "a", + "type": { + "kind": "boolean" + }, + "visibility": "private" + }, + { + "name": "b", + "type": { + "kind": "tuple", + "fields": [ + { + "kind": "array", + "length": 2, + "type": { + "kind": "boolean" + } + }, + { + "kind": "array", + "length": 2, + "type": { + "kind": "boolean" + } + }, + { + "kind": "string", + "length": 2 + }, + { + "kind": "tuple", + "fields": [ + { + "kind": "integer", + "sign": "unsigned", + "width": 16 + }, + { + "kind": "integer", + "sign": "unsigned", + "width": 16 + } + ] + }, + { + "kind": "integer", + "sign": "unsigned", + "width": 16 + } + ] + }, + "visibility": "private" + }, + { + "name": "c", + "type": { + "kind": "tuple", + "fields": [ + { + "kind": "tuple", + "fields": [ + { + "kind": "field" + }, + { + "kind": "string", + "length": 0 + }, + { + "kind": "boolean" + }, + { + "kind": "boolean" + } + ] + }, + { + "kind": "tuple", + "fields": [ + { + "kind": "integer", + "sign": "unsigned", + "width": 16 + }, + { + "kind": "string", + "length": 2 + } + ] + } + ] + }, + "visibility": "private" + } + ], + "return_type": { + "abi_type": { + "kind": "integer", + "sign": "unsigned", + "width": 16 + }, + "visibility": "public" + }, + "error_types": {} + }, + "bytecode": "H4sIAAAAAAAA/81Y23KbQAwV4NRgmsZ2cFPXfusP7JqL4S2/Elr4/08omqymyiL3BW3GmmEEWjhIR9prBO9ynq5f7j6arsRpeua2SLDFgi0RbCvB9jBdqWf7ItjW07X1bKlgywRbLvz3q2B7FL79Jvjy5Gwrx1EMcyH+Xp02y8SmelhGcFcFe+yHmnOxc3qPfPiElKapquF6GWxp38yl69vaVHXftLa1dVv/ubRlObRVe+367mo6W5WDHeuuHN3P8kBEK2IZXjQ7mBccErO9EcdSfhAjd/+6U37sXjHeZy2/KvsWMh9xwHws9bEA3UFGu29ijosAuTlAmD6PuNS/tfth6rhYysEwjuNU8793SnjE6d7hgW7cHyavWLkOckWs76DbxzXHja5qesTIQXcsL4Q6X1KXTd81mlia+X1RzAVfGN+qbbNMLMa+VsTD+n5h/irhGs7Bj1BkrJWLn8jQnpiOcN8TMiboCPMiWBr3Z+6sMggzOWn7qVkLnNefTp/IaVq9YIO/HT7BvxUNifbK5qhYSCdFrLMiFuf0DOF2gUeXR+0BNAuUI7NQgIl2zNs7jZmO1gA+9k06mktcOx614dEaTn64e8AcbuB9IsTjMDz+wuOuJw/DxyVeU6czpzfsm0Qvvgvh52HwzRrmsmH3uddG8a+E76Ibz7Gn//eub+e2R6GNMJ+d5v5SHJmnDwxXkUtL+EUYfDFXB3ZfeHFyvl+VfCA8mvceYC6x10bv+n0m0vfP+r4kwr9IqGb4Tp34/AsJx6i+HxgAAA==", + "debug_symbols": "jdHLqoMwEAbgd5l1Frkc29pXORSJOpZAiJImhSK+e8dM7WVR6OozGf/RYWbosc3nxoVhvMDxf4Y2Ou/dufFjZ5MbA93Oi4Dt2KSISFfwVqfUZCOGBMeQvRdwtT6Xly6TDcVkI1WlAAw9SQ0H53F9WsQrLb9Hda0fYSOrZ7z6Oa+q7ePGyI/8iU62c/FjYlAVZQSoHbNnDkxd0JJRjGYM88dQF/pvvWP2zIGpC0YyitEMddHLOk10tvX4WMKQQ/e2k3Sbtsq2tSmOHfY54jpNqdF8dw==", + "file_map": { + "50": { + "source": "fn main(\n a: bool,\n b: ([bool; 2], [bool; 2], str<2>, (u16, u16), u16),\n c: ((Field, str<0>, bool, bool), (u16, str<2>)),\n) -> pub u16 {\n b.4\n % if c.0.2 {\n b.3.0\n } else {\n if (!a) {\n 37995\n } else {\n (b.3.1 % 64485)\n }\n }\n}\n", + "path": "" + } + }, + "names": [ + "main" + ], + "brillig_names": [ + "directive_integer_quotient", + "directive_invert" + ] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8261/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8261/execute__tests__force_brillig_false_inliner_0.snap new file mode 100644 index 00000000000..6c7f581c86f --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8261/execute__tests__force_brillig_false_inliner_0.snap @@ -0,0 +1,131 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: artifact +--- +{ + "noir_version": "[noir_version]", + "hash": "[hash]", + "abi": { + "parameters": [ + { + "name": "a", + "type": { + "kind": "boolean" + }, + "visibility": "private" + }, + { + "name": "b", + "type": { + "kind": "tuple", + "fields": [ + { + "kind": "array", + "length": 2, + "type": { + "kind": "boolean" + } + }, + { + "kind": "array", + "length": 2, + "type": { + "kind": "boolean" + } + }, + { + "kind": "string", + "length": 2 + }, + { + "kind": "tuple", + "fields": [ + { + "kind": "integer", + "sign": "unsigned", + "width": 16 + }, + { + "kind": "integer", + "sign": "unsigned", + "width": 16 + } + ] + }, + { + "kind": "integer", + "sign": "unsigned", + "width": 16 + } + ] + }, + "visibility": "private" + }, + { + "name": "c", + "type": { + "kind": "tuple", + "fields": [ + { + "kind": "tuple", + "fields": [ + { + "kind": "field" + }, + { + "kind": "string", + "length": 0 + }, + { + "kind": "boolean" + }, + { + "kind": "boolean" + } + ] + }, + { + "kind": "tuple", + "fields": [ + { + "kind": "integer", + "sign": "unsigned", + "width": 16 + }, + { + "kind": "string", + "length": 2 + } + ] + } + ] + }, + "visibility": "private" + } + ], + "return_type": { + "abi_type": { + "kind": "integer", + "sign": "unsigned", + "width": 16 + }, + "visibility": "public" + }, + "error_types": {} + }, + "bytecode": "H4sIAAAAAAAA/81Y23KbQAwV4NRgmsZ2cFPXfusP7JqL4S2/Elr4/08omqymyiL3BW3GmmEEWjhIR9prBO9ynq5f7j6arsRpeua2SLDFgi0RbCvB9jBdqWf7ItjW07X1bKlgywRbLvz3q2B7FL79Jvjy5Gwrx1EMcyH+Xp02y8SmelhGcFcFe+yHmnOxc3qPfPiElKapquF6GWxp38yl69vaVHXftLa1dVv/ubRlObRVe+367mo6W5WDHeuuHN3P8kBEK2IZXjQ7mBccErO9EcdSfhAjd/+6U37sXjHeZy2/KvsWMh9xwHws9bEA3UFGu29ijosAuTlAmD6PuNS/tfth6rhYysEwjuNU8793SnjE6d7hgW7cHyavWLkOckWs76DbxzXHja5qesTIQXcsL4Q6X1KXTd81mlia+X1RzAVfGN+qbbNMLMa+VsTD+n5h/irhGs7Bj1BkrJWLn8jQnpiOcN8TMiboCPMiWBr3Z+6sMggzOWn7qVkLnNefTp/IaVq9YIO/HT7BvxUNifbK5qhYSCdFrLMiFuf0DOF2gUeXR+0BNAuUI7NQgIl2zNs7jZmO1gA+9k06mktcOx614dEaTn64e8AcbuB9IsTjMDz+wuOuJw/DxyVeU6czpzfsm0Qvvgvh52HwzRrmsmH3uddG8a+E76Ibz7Gn//eub+e2R6GNMJ+d5v5SHJmnDwxXkUtL+EUYfDFXB3ZfeHFyvl+VfCA8mvceYC6x10bv+n0m0vfP+r4kwr9IqGb4Tp34/AsJx6i+HxgAAA==", + "debug_symbols": "jdHLqoMwEAbgd5l1Frkc29pXORSJOpZAiJImhSK+e8dM7WVR6OozGf/RYWbosc3nxoVhvMDxf4Y2Ou/dufFjZ5MbA93Oi4Dt2KSISFfwVqfUZCOGBMeQvRdwtT6Xly6TDcVkI1WlAAw9SQ0H53F9WsQrLb9Hda0fYSOrZ7z6Oa+q7ePGyI/8iU62c/FjYlAVZQSoHbNnDkxd0JJRjGYM88dQF/pvvWP2zIGpC0YyitEMddHLOk10tvX4WMKQQ/e2k3Sbtsq2tSmOHfY54jpNqdF8dw==", + "file_map": { + "50": { + "source": "fn main(\n a: bool,\n b: ([bool; 2], [bool; 2], str<2>, (u16, u16), u16),\n c: ((Field, str<0>, bool, bool), (u16, str<2>)),\n) -> pub u16 {\n b.4\n % if c.0.2 {\n b.3.0\n } else {\n if (!a) {\n 37995\n } else {\n (b.3.1 % 64485)\n }\n }\n}\n", + "path": "" + } + }, + "names": [ + "main" + ], + "brillig_names": [ + "directive_integer_quotient", + "directive_invert" + ] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8261/execute__tests__force_brillig_false_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8261/execute__tests__force_brillig_false_inliner_9223372036854775807.snap new file mode 100644 index 00000000000..6c7f581c86f --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8261/execute__tests__force_brillig_false_inliner_9223372036854775807.snap @@ -0,0 +1,131 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: artifact +--- +{ + "noir_version": "[noir_version]", + "hash": "[hash]", + "abi": { + "parameters": [ + { + "name": "a", + "type": { + "kind": "boolean" + }, + "visibility": "private" + }, + { + "name": "b", + "type": { + "kind": "tuple", + "fields": [ + { + "kind": "array", + "length": 2, + "type": { + "kind": "boolean" + } + }, + { + "kind": "array", + "length": 2, + "type": { + "kind": "boolean" + } + }, + { + "kind": "string", + "length": 2 + }, + { + "kind": "tuple", + "fields": [ + { + "kind": "integer", + "sign": "unsigned", + "width": 16 + }, + { + "kind": "integer", + "sign": "unsigned", + "width": 16 + } + ] + }, + { + "kind": "integer", + "sign": "unsigned", + "width": 16 + } + ] + }, + "visibility": "private" + }, + { + "name": "c", + "type": { + "kind": "tuple", + "fields": [ + { + "kind": "tuple", + "fields": [ + { + "kind": "field" + }, + { + "kind": "string", + "length": 0 + }, + { + "kind": "boolean" + }, + { + "kind": "boolean" + } + ] + }, + { + "kind": "tuple", + "fields": [ + { + "kind": "integer", + "sign": "unsigned", + "width": 16 + }, + { + "kind": "string", + "length": 2 + } + ] + } + ] + }, + "visibility": "private" + } + ], + "return_type": { + "abi_type": { + "kind": "integer", + "sign": "unsigned", + "width": 16 + }, + "visibility": "public" + }, + "error_types": {} + }, + "bytecode": "H4sIAAAAAAAA/81Y23KbQAwV4NRgmsZ2cFPXfusP7JqL4S2/Elr4/08omqymyiL3BW3GmmEEWjhIR9prBO9ynq5f7j6arsRpeua2SLDFgi0RbCvB9jBdqWf7ItjW07X1bKlgywRbLvz3q2B7FL79Jvjy5Gwrx1EMcyH+Xp02y8SmelhGcFcFe+yHmnOxc3qPfPiElKapquF6GWxp38yl69vaVHXftLa1dVv/ubRlObRVe+367mo6W5WDHeuuHN3P8kBEK2IZXjQ7mBccErO9EcdSfhAjd/+6U37sXjHeZy2/KvsWMh9xwHws9bEA3UFGu29ijosAuTlAmD6PuNS/tfth6rhYysEwjuNU8793SnjE6d7hgW7cHyavWLkOckWs76DbxzXHja5qesTIQXcsL4Q6X1KXTd81mlia+X1RzAVfGN+qbbNMLMa+VsTD+n5h/irhGs7Bj1BkrJWLn8jQnpiOcN8TMiboCPMiWBr3Z+6sMggzOWn7qVkLnNefTp/IaVq9YIO/HT7BvxUNifbK5qhYSCdFrLMiFuf0DOF2gUeXR+0BNAuUI7NQgIl2zNs7jZmO1gA+9k06mktcOx614dEaTn64e8AcbuB9IsTjMDz+wuOuJw/DxyVeU6czpzfsm0Qvvgvh52HwzRrmsmH3uddG8a+E76Ibz7Gn//eub+e2R6GNMJ+d5v5SHJmnDwxXkUtL+EUYfDFXB3ZfeHFyvl+VfCA8mvceYC6x10bv+n0m0vfP+r4kwr9IqGb4Tp34/AsJx6i+HxgAAA==", + "debug_symbols": "jdHLqoMwEAbgd5l1Frkc29pXORSJOpZAiJImhSK+e8dM7WVR6OozGf/RYWbosc3nxoVhvMDxf4Y2Ou/dufFjZ5MbA93Oi4Dt2KSISFfwVqfUZCOGBMeQvRdwtT6Xly6TDcVkI1WlAAw9SQ0H53F9WsQrLb9Hda0fYSOrZ7z6Oa+q7ePGyI/8iU62c/FjYlAVZQSoHbNnDkxd0JJRjGYM88dQF/pvvWP2zIGpC0YyitEMddHLOk10tvX4WMKQQ/e2k3Sbtsq2tSmOHfY54jpNqdF8dw==", + "file_map": { + "50": { + "source": "fn main(\n a: bool,\n b: ([bool; 2], [bool; 2], str<2>, (u16, u16), u16),\n c: ((Field, str<0>, bool, bool), (u16, str<2>)),\n) -> pub u16 {\n b.4\n % if c.0.2 {\n b.3.0\n } else {\n if (!a) {\n 37995\n } else {\n (b.3.1 % 64485)\n }\n }\n}\n", + "path": "" + } + }, + "names": [ + "main" + ], + "brillig_names": [ + "directive_integer_quotient", + "directive_invert" + ] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8261/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8261/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap new file mode 100644 index 00000000000..cdbfd13d4ae --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8261/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap @@ -0,0 +1,135 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: artifact +--- +{ + "noir_version": "[noir_version]", + "hash": "[hash]", + "abi": { + "parameters": [ + { + "name": "a", + "type": { + "kind": "boolean" + }, + "visibility": "private" + }, + { + "name": "b", + "type": { + "kind": "tuple", + "fields": [ + { + "kind": "array", + "length": 2, + "type": { + "kind": "boolean" + } + }, + { + "kind": "array", + "length": 2, + "type": { + "kind": "boolean" + } + }, + { + "kind": "string", + "length": 2 + }, + { + "kind": "tuple", + "fields": [ + { + "kind": "integer", + "sign": "unsigned", + "width": 16 + }, + { + "kind": "integer", + "sign": "unsigned", + "width": 16 + } + ] + }, + { + "kind": "integer", + "sign": "unsigned", + "width": 16 + } + ] + }, + "visibility": "private" + }, + { + "name": "c", + "type": { + "kind": "tuple", + "fields": [ + { + "kind": "tuple", + "fields": [ + { + "kind": "field" + }, + { + "kind": "string", + "length": 0 + }, + { + "kind": "boolean" + }, + { + "kind": "boolean" + } + ] + }, + { + "kind": "tuple", + "fields": [ + { + "kind": "integer", + "sign": "unsigned", + "width": 16 + }, + { + "kind": "string", + "length": 2 + } + ] + } + ] + }, + "visibility": "private" + } + ], + "return_type": { + "abi_type": { + "kind": "integer", + "sign": "unsigned", + "width": 16 + }, + "visibility": "public" + }, + "error_types": { + "17843811134343075018": { + "error_kind": "string", + "string": "Stack too deep" + } + } + }, + "bytecode": "H4sIAAAAAAAA/+1Z227TQBBd2+ukTpqL4EecJibtWx56b0LTlmcklxIBEkLiCSEe/ALfTUfdwcdjOyLEi7pSRop8Occzs7NnL3Y89WTDx59nzrU59lTZmDMzx3g7GzXoK6bcfMv5eg3maytH37GaBg7UVDtW09CBmrYs5Ggjz7Yjee45kmfkSJ4d1eyYr7Kmc+46Utt9R/LsKbfm/b56/vP+QNkZV8PSiUmeik6bDFrEaWGkhYcmdZowaTKigU4Dh0RJHU5FHAgfVX7JfpljZI4+4A1ubEaRiNuk/8M4SSJVtIbzH0fGZ9+K/1HM/gd28o/bxs9xlvvHtnDcQPDkM8g5Ac5JDecUOKc1nDPgnNVwzoFzXsO5AM4FcDzgXALnsoZzBZwr4PjAmQNnXsNZAGdRw7kGzjVwFHCWwFnWcG6Ac1MT6xY4t8DBtt8B505wenDOdmw4EcRTqunxPUksj48Dblsf2sbt5NhDO7HHnoinVN4fiHH8jrI5Fz19JMB4nI+sD/c1f2gJsjwfiems3A7GQsC4f2ltews8qS3OI1JF/Tasu+lOd27pLhCYzsrt2FR3WBOpO22hFo+6O9rpzi3dyY/OOiu3Y1Pdobb6AgtVbrxHYawF2FxgbcAWAtsD7LXBWAu4f29Q5yvb+951Ov8bHZJxv7ugw0hgGrB/1SH2vdRhR+XG+1fGuoAtBbYPGO9XWQs9iNfgO+LBbk51a07tCUxn5XZsqmXUVh94H+H8k/D9Jsufkf1p530nmdjc11L/vKzJX0Eb25n6Y4wFcI9rznXaQ77AIsB0VozTMdca4qAvziMU/A/mmvu7Bc/w88OK+C0Rv5B3xT2skfQVVNxjPq3DqTnvmh/pi6mhKs6h3+G5z4LDsb8C5wvHFhzu15m5jrewo8mr+6r3Lw/y+PYf8ljdv0/Yt4ba+6q455Hxca/kA1+v4Qcif+mf/VXVJaioi1wX8Bni/VjDCyt4nvCBdWgDp1/TLqyDv4Yv+1H6Z3+ka94j6KyIz8z9eAubHuYfynleCSE+mgYc+T/NdQfy5+M2f46vpuloNU5XaZI+PEzepS+Ef6XyGlOdfgN3tSDbsSIAAA==", + "debug_symbols": "jZDNqsMgEIXfZdYu/In33uZVSggmmRRBTLB6oQTfvWNr+rModOOnczxn4Gww4ZBOvfXzcob2uMEQrHP21LtlNNEunqYb8HII0UArGFFX/lT+3ilJl4W6knSZM4M9q48BsUS9hNPK1QT0EVqfnGPwb1y6fTqvxt8YTSCVM0A/ESlwtg7LLbOnm3+2yoOsZsX1w66/9gu9L1eKv/k7epnRhre6ckkK1gwO63NOfnxR42Xdlb3uNSwjTilgSXp2rqigQ8MEbzoqlEZHIf+YUKrLZfkV", + "file_map": { + "50": { + "source": "fn main(\n a: bool,\n b: ([bool; 2], [bool; 2], str<2>, (u16, u16), u16),\n c: ((Field, str<0>, bool, bool), (u16, str<2>)),\n) -> pub u16 {\n b.4\n % if c.0.2 {\n b.3.0\n } else {\n if (!a) {\n 37995\n } else {\n (b.3.1 % 64485)\n }\n }\n}\n", + "path": "" + } + }, + "names": [ + "main" + ], + "brillig_names": [ + "main" + ] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8261/execute__tests__force_brillig_true_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8261/execute__tests__force_brillig_true_inliner_0.snap new file mode 100644 index 00000000000..cdbfd13d4ae --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8261/execute__tests__force_brillig_true_inliner_0.snap @@ -0,0 +1,135 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: artifact +--- +{ + "noir_version": "[noir_version]", + "hash": "[hash]", + "abi": { + "parameters": [ + { + "name": "a", + "type": { + "kind": "boolean" + }, + "visibility": "private" + }, + { + "name": "b", + "type": { + "kind": "tuple", + "fields": [ + { + "kind": "array", + "length": 2, + "type": { + "kind": "boolean" + } + }, + { + "kind": "array", + "length": 2, + "type": { + "kind": "boolean" + } + }, + { + "kind": "string", + "length": 2 + }, + { + "kind": "tuple", + "fields": [ + { + "kind": "integer", + "sign": "unsigned", + "width": 16 + }, + { + "kind": "integer", + "sign": "unsigned", + "width": 16 + } + ] + }, + { + "kind": "integer", + "sign": "unsigned", + "width": 16 + } + ] + }, + "visibility": "private" + }, + { + "name": "c", + "type": { + "kind": "tuple", + "fields": [ + { + "kind": "tuple", + "fields": [ + { + "kind": "field" + }, + { + "kind": "string", + "length": 0 + }, + { + "kind": "boolean" + }, + { + "kind": "boolean" + } + ] + }, + { + "kind": "tuple", + "fields": [ + { + "kind": "integer", + "sign": "unsigned", + "width": 16 + }, + { + "kind": "string", + "length": 2 + } + ] + } + ] + }, + "visibility": "private" + } + ], + "return_type": { + "abi_type": { + "kind": "integer", + "sign": "unsigned", + "width": 16 + }, + "visibility": "public" + }, + "error_types": { + "17843811134343075018": { + "error_kind": "string", + "string": "Stack too deep" + } + } + }, + "bytecode": "H4sIAAAAAAAA/+1Z227TQBBd2+ukTpqL4EecJibtWx56b0LTlmcklxIBEkLiCSEe/ALfTUfdwcdjOyLEi7pSRop8Occzs7NnL3Y89WTDx59nzrU59lTZmDMzx3g7GzXoK6bcfMv5eg3maytH37GaBg7UVDtW09CBmrYs5Ggjz7Yjee45kmfkSJ4d1eyYr7Kmc+46Utt9R/LsKbfm/b56/vP+QNkZV8PSiUmeik6bDFrEaWGkhYcmdZowaTKigU4Dh0RJHU5FHAgfVX7JfpljZI4+4A1ubEaRiNuk/8M4SSJVtIbzH0fGZ9+K/1HM/gd28o/bxs9xlvvHtnDcQPDkM8g5Ac5JDecUOKc1nDPgnNVwzoFzXsO5AM4FcDzgXALnsoZzBZwr4PjAmQNnXsNZAGdRw7kGzjVwFHCWwFnWcG6Ac1MT6xY4t8DBtt8B505wenDOdmw4EcRTqunxPUksj48Dblsf2sbt5NhDO7HHnoinVN4fiHH8jrI5Fz19JMB4nI+sD/c1f2gJsjwfiems3A7GQsC4f2ltews8qS3OI1JF/Tasu+lOd27pLhCYzsrt2FR3WBOpO22hFo+6O9rpzi3dyY/OOiu3Y1Pdobb6AgtVbrxHYawF2FxgbcAWAtsD7LXBWAu4f29Q5yvb+951Ov8bHZJxv7ugw0hgGrB/1SH2vdRhR+XG+1fGuoAtBbYPGO9XWQs9iNfgO+LBbk51a07tCUxn5XZsqmXUVh94H+H8k/D9Jsufkf1p530nmdjc11L/vKzJX0Eb25n6Y4wFcI9rznXaQ77AIsB0VozTMdca4qAvziMU/A/mmvu7Bc/w88OK+C0Rv5B3xT2skfQVVNxjPq3DqTnvmh/pi6mhKs6h3+G5z4LDsb8C5wvHFhzu15m5jrewo8mr+6r3Lw/y+PYf8ljdv0/Yt4ba+6q455Hxca/kA1+v4Qcif+mf/VXVJaioi1wX8Bni/VjDCyt4nvCBdWgDp1/TLqyDv4Yv+1H6Z3+ka94j6KyIz8z9eAubHuYfynleCSE+mgYc+T/NdQfy5+M2f46vpuloNU5XaZI+PEzepS+Ef6XyGlOdfgN3tSDbsSIAAA==", + "debug_symbols": "jZDNqsMgEIXfZdYu/In33uZVSggmmRRBTLB6oQTfvWNr+rModOOnczxn4Gww4ZBOvfXzcob2uMEQrHP21LtlNNEunqYb8HII0UArGFFX/lT+3ilJl4W6knSZM4M9q48BsUS9hNPK1QT0EVqfnGPwb1y6fTqvxt8YTSCVM0A/ESlwtg7LLbOnm3+2yoOsZsX1w66/9gu9L1eKv/k7epnRhre6ckkK1gwO63NOfnxR42Xdlb3uNSwjTilgSXp2rqigQ8MEbzoqlEZHIf+YUKrLZfkV", + "file_map": { + "50": { + "source": "fn main(\n a: bool,\n b: ([bool; 2], [bool; 2], str<2>, (u16, u16), u16),\n c: ((Field, str<0>, bool, bool), (u16, str<2>)),\n) -> pub u16 {\n b.4\n % if c.0.2 {\n b.3.0\n } else {\n if (!a) {\n 37995\n } else {\n (b.3.1 % 64485)\n }\n }\n}\n", + "path": "" + } + }, + "names": [ + "main" + ], + "brillig_names": [ + "main" + ] +} diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_8261/execute__tests__force_brillig_true_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8261/execute__tests__force_brillig_true_inliner_9223372036854775807.snap new file mode 100644 index 00000000000..cdbfd13d4ae --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_8261/execute__tests__force_brillig_true_inliner_9223372036854775807.snap @@ -0,0 +1,135 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: artifact +--- +{ + "noir_version": "[noir_version]", + "hash": "[hash]", + "abi": { + "parameters": [ + { + "name": "a", + "type": { + "kind": "boolean" + }, + "visibility": "private" + }, + { + "name": "b", + "type": { + "kind": "tuple", + "fields": [ + { + "kind": "array", + "length": 2, + "type": { + "kind": "boolean" + } + }, + { + "kind": "array", + "length": 2, + "type": { + "kind": "boolean" + } + }, + { + "kind": "string", + "length": 2 + }, + { + "kind": "tuple", + "fields": [ + { + "kind": "integer", + "sign": "unsigned", + "width": 16 + }, + { + "kind": "integer", + "sign": "unsigned", + "width": 16 + } + ] + }, + { + "kind": "integer", + "sign": "unsigned", + "width": 16 + } + ] + }, + "visibility": "private" + }, + { + "name": "c", + "type": { + "kind": "tuple", + "fields": [ + { + "kind": "tuple", + "fields": [ + { + "kind": "field" + }, + { + "kind": "string", + "length": 0 + }, + { + "kind": "boolean" + }, + { + "kind": "boolean" + } + ] + }, + { + "kind": "tuple", + "fields": [ + { + "kind": "integer", + "sign": "unsigned", + "width": 16 + }, + { + "kind": "string", + "length": 2 + } + ] + } + ] + }, + "visibility": "private" + } + ], + "return_type": { + "abi_type": { + "kind": "integer", + "sign": "unsigned", + "width": 16 + }, + "visibility": "public" + }, + "error_types": { + "17843811134343075018": { + "error_kind": "string", + "string": "Stack too deep" + } + } + }, + "bytecode": "H4sIAAAAAAAA/+1Z227TQBBd2+ukTpqL4EecJibtWx56b0LTlmcklxIBEkLiCSEe/ALfTUfdwcdjOyLEi7pSRop8Occzs7NnL3Y89WTDx59nzrU59lTZmDMzx3g7GzXoK6bcfMv5eg3maytH37GaBg7UVDtW09CBmrYs5Ggjz7Yjee45kmfkSJ4d1eyYr7Kmc+46Utt9R/LsKbfm/b56/vP+QNkZV8PSiUmeik6bDFrEaWGkhYcmdZowaTKigU4Dh0RJHU5FHAgfVX7JfpljZI4+4A1ubEaRiNuk/8M4SSJVtIbzH0fGZ9+K/1HM/gd28o/bxs9xlvvHtnDcQPDkM8g5Ac5JDecUOKc1nDPgnNVwzoFzXsO5AM4FcDzgXALnsoZzBZwr4PjAmQNnXsNZAGdRw7kGzjVwFHCWwFnWcG6Ac1MT6xY4t8DBtt8B505wenDOdmw4EcRTqunxPUksj48Dblsf2sbt5NhDO7HHnoinVN4fiHH8jrI5Fz19JMB4nI+sD/c1f2gJsjwfiems3A7GQsC4f2ltews8qS3OI1JF/Tasu+lOd27pLhCYzsrt2FR3WBOpO22hFo+6O9rpzi3dyY/OOiu3Y1Pdobb6AgtVbrxHYawF2FxgbcAWAtsD7LXBWAu4f29Q5yvb+951Ov8bHZJxv7ugw0hgGrB/1SH2vdRhR+XG+1fGuoAtBbYPGO9XWQs9iNfgO+LBbk51a07tCUxn5XZsqmXUVh94H+H8k/D9Jsufkf1p530nmdjc11L/vKzJX0Eb25n6Y4wFcI9rznXaQ77AIsB0VozTMdca4qAvziMU/A/mmvu7Bc/w88OK+C0Rv5B3xT2skfQVVNxjPq3DqTnvmh/pi6mhKs6h3+G5z4LDsb8C5wvHFhzu15m5jrewo8mr+6r3Lw/y+PYf8ljdv0/Yt4ba+6q455Hxca/kA1+v4Qcif+mf/VXVJaioi1wX8Bni/VjDCyt4nvCBdWgDp1/TLqyDv4Yv+1H6Z3+ka94j6KyIz8z9eAubHuYfynleCSE+mgYc+T/NdQfy5+M2f46vpuloNU5XaZI+PEzepS+Ef6XyGlOdfgN3tSDbsSIAAA==", + "debug_symbols": "jZDNqsMgEIXfZdYu/In33uZVSggmmRRBTLB6oQTfvWNr+rModOOnczxn4Gww4ZBOvfXzcob2uMEQrHP21LtlNNEunqYb8HII0UArGFFX/lT+3ilJl4W6knSZM4M9q48BsUS9hNPK1QT0EVqfnGPwb1y6fTqvxt8YTSCVM0A/ESlwtg7LLbOnm3+2yoOsZsX1w66/9gu9L1eKv/k7epnRhre6ckkK1gwO63NOfnxR42Xdlb3uNSwjTilgSXp2rqigQ8MEbzoqlEZHIf+YUKrLZfkV", + "file_map": { + "50": { + "source": "fn main(\n a: bool,\n b: ([bool; 2], [bool; 2], str<2>, (u16, u16), u16),\n c: ((Field, str<0>, bool, bool), (u16, str<2>)),\n) -> pub u16 {\n b.4\n % if c.0.2 {\n b.3.0\n } else {\n if (!a) {\n 37995\n } else {\n (b.3.1 % 64485)\n }\n }\n}\n", + "path": "" + } + }, + "names": [ + "main" + ], + "brillig_names": [ + "main" + ] +} diff --git a/tooling/nargo_cli/tests/snapshots/expand/execution_success/regression_8261/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/expand/execution_success/regression_8261/execute__tests__expanded.snap new file mode 100644 index 00000000000..9121319cca0 --- /dev/null +++ b/tooling/nargo_cli/tests/snapshots/expand/execution_success/regression_8261/execute__tests__expanded.snap @@ -0,0 +1,20 @@ +--- +source: tooling/nargo_cli/tests/execute.rs +expression: expanded_code +--- +fn main( + a: bool, + b: ([bool; 2], [bool; 2], str<2>, (u16, u16), u16), + c: ((Field, str<0>, bool, bool), (u16, str<2>)), +) -> pub u16 { + b.4 + % if c.0.2 { + b.3.0 + } else { + if !a { + 37995 + } else { + b.3.1 % 64485 + } + } +}