Skip to content

Commit

Permalink
fix: regression location integer overflow (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
xensik authored Jul 14, 2024
1 parent 9ebbc0f commit 4fcedf3
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
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

0 comments on commit 4fcedf3

Please sign in to comment.