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

fix: regression location integer overflow #215

Merged
merged 3 commits into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/xsk/arc/common/assembly.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ enum class opcode : u8

struct sourcepos
{
u16 line;
u16 column;
i32 line;
i32 column;
};

struct instruction
Expand Down
2 changes: 1 addition & 1 deletion include/xsk/arc/common/location.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class position
{
public:
typedef const std::string filename_type;
typedef u16 counter_type;
typedef i32 counter_type;

filename_type *filename;
counter_type line;
Expand Down
4 changes: 2 additions & 2 deletions include/xsk/gsc/common/assembly.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ enum class opcode : u8

struct sourcepos
{
u16 line;
u16 column;
i32 line;
i32 column;
};

struct instruction
Expand Down
2 changes: 1 addition & 1 deletion include/xsk/gsc/common/location.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class position
{
public:
typedef const std::string filename_type;
typedef u16 counter_type;
typedef i32 counter_type;

filename_type *filename;
counter_type line;
Expand Down
4 changes: 2 additions & 2 deletions src/arc/assembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ auto assembler::assemble_instruction(instruction const& inst) -> void
if ((ctx_->build() & build::dev_maps) != build::prod)
{
devmap_.write<u32>(script_.pos());
devmap_.write<u16>(inst.pos.line);
devmap_.write<u16>(inst.pos.column);
devmap_.write<u16>(static_cast<u16>(inst.pos.line));
devmap_.write<u16>(static_cast<u16>(inst.pos.column));
devmap_count_++;
}

Expand Down
4 changes: 2 additions & 2 deletions src/gsc/assembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ auto assembler::assemble_instruction(instruction const& inst) -> void
if ((ctx_->build() & build::dev_maps) != build::prod)
{
devmap_.write<u32>(script_.pos());
devmap_.write<u16>(inst.pos.line);
devmap_.write<u16>(inst.pos.column);
devmap_.write<u16>(static_cast<u16>(inst.pos.line));
devmap_.write<u16>(static_cast<u16>(inst.pos.column));
devmap_count_++;
}

Expand Down
Loading