Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mload(0) has different values in solc. #203

Closed
Subway2023 opened this issue Feb 10, 2025 · 1 comment · Fixed by #211
Closed

mload(0) has different values in solc. #203

Subway2023 opened this issue Feb 10, 2025 · 1 comment · Fixed by #211

Comments

@Subway2023
Copy link

I have set up an execution environment that can directly execute the bytecode generated by revive compilation.

contract C {
    function g() external view returns (uint s, uint m, uint t) {
        assembly {
            s := sload(0)
            m := mload(0)
            t := tload(0)
        }
    }
}

Run with resolc

compile

resolc --solc solc test.sol --combined-json hashes,bin,abi -o /tmp/tmpdh_0t_pr --overwrite

execute

revive/target/release/revive-runner 50564d0000c409000000000000010700c14000c0004004808f08000000000e0000001c0000002a0000003500000040000000520000005d00000063616c6c5f646174615f636f707963616c6c5f646174615f6c6f616463616c6c5f646174615f73697a656765745f73746f726167657365616c5f72657475726e7365745f696d6d757461626c655f646174617365745f73746f7261676576616c75655f7472616e7366657272656405110287cf0463616c6c87d6066465706c6f79068905130287df5d0076007b009a00040134014a015c018001fd025d03d7036704b504c805c706a807d607de0764798b7a103307520a41330a000001ac8a39c8980883871f8477e054370000010a330732003908000002ae78143d0700000264783307200002c8870732003307200002c88707320032009511f07b10087b1584750133073308501002a73e070800020a02013e071000023b0520000351050750100409501006e6009511c07b10387b15307b16289515408411e064163307403308205010086bff5107b3003308080002210358000221035000022103480002140700000000000000807b68103e076000029517e08477e07b67186471491718491710491708490783770a0701826a1882a71082a81882a90882aad49808d4a707d4870752074b33078000330850100a01ff510749826710837780007b6718330833090a01390814000251080d330740000383770a050133078000330850100cd1fe510719330782681833090a04013307330850100ebbfe5207040081681033070133093300100a0401951180fe7b1078017b1570017b166801951580018411e0641633074033082050101285fe5107e10133090800023308100002210358000221035000027b6898003908100002140700000000000000803e076000027b69900021034800025418039b018367a00033080a01018167bc0051478e9b17e248015247f01f122681019517e08477e07b6788006471491718491710491708490783770a0701826a880082a71082a81882a90882aad49808d4a707d48707520745018267980081775317043b014926d8004926d0004926c8004926c0009517e08477e06471491718491710491708490715837a8368c0003307013309ff330b200a064926f8004926f0004926e8004926e0009517e08477e0647149171849171049170849072a837a8368e0003309ff330b2033070a06492618014926100149260801492600019517e08477e064714917184917104917084907647a7b6798009517f88477e064714917184917104917084907000183aa837b836800013307013309ff0a03826a980082a71882a80882a982aa10d48707859815d4a808d487077b6798003307330850101408fd826898005208b70451075c81689000330733090a04019517e08477e07b6788006471491718491710491708490783770a0701826a880082a71082a81882a90882aad49808d4a707d4870752070d8267980081775517041233073308501016a8fc52075f0400492638014926300149262801492620019517e08477e064714917184917104917084907647a7b6798009517f88477e064714917184917104917084907000183aa837b836820013309ff33070a03826898008287187b6788008287107b6780008287087b677882877b67980033082033075010182efc51078a826890008287187b67688287107b67608287087b675882877b6750492658014926500149264801492640019517e08477e064714917184917104917084907647a7b67709517f88477e064714917184917104917084907000183aa837b836840013307013309ff0a038268708287187b67388287107b67408287087b674882877b677033074033082050101a9efb5107fafe826a900082a74882a84082a95082aa586f7b6f8c6f996faad4c907d4ba08d47808988820d4b707977720d487075207c9fe7b6c107b6b187b693083a73308207b67207b6a2850101c50fb5107acfe82679000826b20c8b709826798006f7798783878981f98783078981e98782878981d98782078981c98781878981b98781078981a8268786f88789718987708789719988738789717988730789716988728789715988720789714988718789713988710789712826780006f7778981098880878981198783878980f98783078980e98782878980d98782078980c98781878980b98781078980a826888006f887897089877087897099887387897079887307897069887287897059887207897049887187897039887107897027898988808826718826a10d4a70c1407e0ffffff00000000826a28d87a07826a3094a794c77898015107b4fd7b6c98007b69800083b7203308207b67880050101e3dfa510799fd8267900082688800c88707826958787908826a5098a83878780798a83078780698a82878780598a82078780498a81878780398a81078780298a808787801787a826a60787a1098983878780f98983078780e98982878780d98982078780c98981878780b98981078780a98980878780982696878791898a83878781798a83078781698a82878781598a82078781498a81878781398a81078781298a80878781198983878781f98983078781e98982878781d98982078781c98981878781b98981078781a9898081409c0ffffff00000000826a28d89a09826a3094a9826a980094a97878195109b0fc8267208377403308207b6798005010203ef951079afc8267900082689800c887078268386f888269406f99826a486faa826b706fbb787b1898bc38787c1f98bc30787c1e98bc28787c1d98bc20787c1c98bc18787c1b98bc10787c1a98bb08787b19787a1098ab38787b1798ab30787b1698ab28787b1598ab20787b1498ab18787b1398ab10787b1298aa08787a11787908989a38787a0f989a30787a0e989a28787a0d989a20787a0c989a18787a0b989a10787a0a98990878790978789889387879079889307879069889287879059889207879049889187879039889107879029888087878013308608267205010225df85107b9fb8168800033096033070a04015107a9fb8168900033070133090a043307330024287ef8330750102479f833070150102671f800a58424092a2414524825a5223484444892a424440821049090a424d5242949a29044ea9050a390522b64521a111129091142081102081142d4080848a224d548529288424444529214498a88484a9222a98888a424154949a22229929224512122514da224d548529244512146442425a9484a1215a948249222854492242522222949252949542425499292848824a94a922491a4242122899224499224254992244992284992244992444992244992a42409204925229208119124499224499294244992244992244992244992244992240920495122498488484a2925499224499224499224499224499224494a92244992240911a911a992424200 e2179b8e

decoded return value

(0, 14474024958157218009172027710213129922644587195160634633456907629857339342848, 0)

Run with remix

{
	"0": "uint256: s 0",
	"1": "uint256: m 0",
	"2": "uint256: t 0"
}
@xermicus
Copy link
Member

Thanks for reporting this. On a first glance it looks like this should return 0 too, I'll have a look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants